Save new group
This commit is contained in:
parent
fc15d8b56e
commit
5658f31457
@ -6,6 +6,7 @@ import { Budget, useSessionStore } from "./session";
|
|||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
Categories: Map<string, Category>;
|
Categories: Map<string, Category>;
|
||||||
|
CategoryGroups: Map<string, CategoryGroup>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface Category {
|
export interface Category {
|
||||||
@ -17,9 +18,15 @@ export interface Category {
|
|||||||
Activity: number;
|
Activity: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface CategoryGroup {
|
||||||
|
ID: string;
|
||||||
|
Name: string;
|
||||||
|
}
|
||||||
|
|
||||||
export const useCategoryStore = defineStore("category", {
|
export const useCategoryStore = defineStore("category", {
|
||||||
state: (): State => ({
|
state: (): State => ({
|
||||||
Categories: new Map<string, Category>(),
|
Categories: new Map<string, Category>(),
|
||||||
|
CategoryGroups: new Map<string, CategoryGroup>(),
|
||||||
}),
|
}),
|
||||||
getters: {
|
getters: {
|
||||||
},
|
},
|
||||||
@ -35,7 +42,7 @@ export const useCategoryStore = defineStore("category", {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
const response = await result.json();
|
const response = await result.json();
|
||||||
useCategoryStore().AddCategory(response);
|
useCategoryStore().AddCategoryGroup(response);
|
||||||
},
|
},
|
||||||
async CreateCategory(
|
async CreateCategory(
|
||||||
group: string,
|
group: string,
|
||||||
@ -54,6 +61,9 @@ export const useCategoryStore = defineStore("category", {
|
|||||||
},
|
},
|
||||||
async AddCategory(category : Category){
|
async AddCategory(category : Category){
|
||||||
this.Categories.set(category.ID, category);
|
this.Categories.set(category.ID, category);
|
||||||
|
},
|
||||||
|
async AddCategoryGroup(categoryGroup : CategoryGroup){
|
||||||
|
this.CategoryGroups.set(categoryGroup.ID, categoryGroup);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
Loading…
x
Reference in New Issue
Block a user