mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
group store init
This commit is contained in:
parent
dcfdc26e62
commit
9e884008d0
2 changed files with 22 additions and 0 deletions
|
@ -4,6 +4,10 @@ const groupPrefix = baseURL + "groups";
|
|||
|
||||
const groupsURLs = {
|
||||
groups: `${groupPrefix}`,
|
||||
create: `${groupPrefix}`,
|
||||
delete: id => `${groupPrefix}/${id}`,
|
||||
current: `${groupPrefix}/self`,
|
||||
update: id => `${groupPrefix}/${id}`,
|
||||
};
|
||||
|
||||
export default {
|
||||
|
@ -11,4 +15,20 @@ export default {
|
|||
let response = await apiReq.get(groupsURLs.groups);
|
||||
return response.data;
|
||||
},
|
||||
async create(name) {
|
||||
let response = await apiReq.post(groupsURLs.create, { name: name });
|
||||
return response.data;
|
||||
},
|
||||
async delete(id) {
|
||||
let response = await apiReq.delete(groupsURLs.delete(id));
|
||||
return response.data;
|
||||
},
|
||||
async current() {
|
||||
let response = await apiReq.get(groupsURLs.current);
|
||||
return response.data;
|
||||
},
|
||||
async update(data) {
|
||||
let response = await apiReq.put(groupsURLs.update(data.id), data);
|
||||
return response.data;
|
||||
},
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@ import userSettings from "./modules/userSettings";
|
|||
import language from "./modules/language";
|
||||
import homePage from "./modules/homePage";
|
||||
import siteSettings from "./modules/siteSettings";
|
||||
import groups from "./modules/groups";
|
||||
|
||||
Vue.use(Vuex);
|
||||
|
||||
|
@ -20,6 +21,7 @@ const store = new Vuex.Store({
|
|||
language,
|
||||
homePage,
|
||||
siteSettings,
|
||||
groups,
|
||||
},
|
||||
state: {
|
||||
// All Recipe Data Store
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue