wishlist-app/src/composables/useWishlistsStore.ts
Benny Samir Hierl a45ab85e71 small changes
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
2022-02-09 23:06:36 +01:00

19 lines
425 B
TypeScript

import useAxios from '@/composables/useAxios'
import { Wishlist } from '@/types'
import { readonly, ref } from 'vue'
const { client } = useAxios()
const prefix = '/wishlist'
const state = ref<Wishlist[]>([])
export const fetch = async (): Promise<void> => {
const { data } = await client.get(prefix)
state.value = data
}
export const useWishlistsStore = () => {
return {
state: readonly(state),
fetch,
}
}