cleanup code

Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
Benny Samir Hierl 2022-02-02 23:20:24 +01:00
parent b41843345b
commit 616208071c

View file

@ -3,11 +3,11 @@ import { Wishlist, WishlistItem } from '@/types'
import { ref } from 'vue' import { ref } from 'vue'
const { client } = useAxios() const { client } = useAxios()
const refState = ref<Wishlist | any>({}) const list = ref<Wishlist | null>(null)
const fetch = async (slugText: string): Promise<void> => { const fetch = async (slugText: string): Promise<void> => {
const { data } = await client.get(`/wishlist/${slugText}`) const { data } = await client.get(`/wishlist/${slugText}`)
refState.value = data list.value = data
} }
const updateItem = async (item: WishlistItem): Promise<void> => { const updateItem = async (item: WishlistItem): Promise<void> => {
@ -16,7 +16,7 @@ const updateItem = async (item: WishlistItem): Promise<void> => {
export const useWishlistStore = () => { export const useWishlistStore = () => {
return { return {
list: refState, list,
fetch, fetch,
updateItem, updateItem,
} }