mirror of
https://github.com/ThisIsBenny/wishlist-app.git
synced 2025-06-07 05:57:41 +00:00
cleanup code
Signed-off-by: Benny Samir Hierl <bennysamir@posteo.de>
This commit is contained in:
parent
b41843345b
commit
616208071c
1 changed files with 3 additions and 3 deletions
|
@ -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,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue