tg app fix sizes
This commit is contained in:
29
src/stores/categories-store.ts
Normal file
29
src/stores/categories-store.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import { categoriesService } from '@/services/categories-service'
|
||||
import { Category } from '@/models/category'
|
||||
|
||||
export const useCategoriesStore = defineStore('categories', () => {
|
||||
const categories = ref<Category[]>([])
|
||||
const isLoading = ref(false)
|
||||
|
||||
const fetchCategories = async (spaceId: number) => {
|
||||
isLoading.value = true
|
||||
try {
|
||||
categories.value = await categoriesService.fetchCategories(spaceId)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const addCategory = (category: Category) => {
|
||||
categories.value.push(category)
|
||||
}
|
||||
|
||||
return {
|
||||
categories,
|
||||
isLoading,
|
||||
fetchCategories,
|
||||
addCategory
|
||||
}
|
||||
})
|
||||
29
src/stores/recurrent-store.ts
Normal file
29
src/stores/recurrent-store.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref } from 'vue'
|
||||
import {RecurrentOperation} from "@/models/recurrent-operation";
|
||||
import {recurrentsService} from "@/services/recurrents-service";
|
||||
|
||||
export const useRecurrentsStore = defineStore('recurrents', () => {
|
||||
const recurrents = ref<RecurrentOperation[]>([])
|
||||
const isLoading = ref(false)
|
||||
|
||||
const fetchRecurrents = async (spaceId: number) => {
|
||||
isLoading.value = true
|
||||
try {
|
||||
recurrents.value = await recurrentsService.fetchRecurrents(spaceId)
|
||||
} finally {
|
||||
isLoading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
const addRecurrent = (recurrent: RecurrentOperation) => {
|
||||
recurrents.value.push(recurrent)
|
||||
}
|
||||
|
||||
return {
|
||||
recurrents,
|
||||
isLoading,
|
||||
fetchRecurrents,
|
||||
addRecurrent
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user