Fixes: 1) Correct missing semicolons in Pinia store definitions for cart, company, wishlist, and auth stores; 2) Refactor GraphQL queries to include fragments for improved modularity and readability; 3) Correct error handling in composables like `usePosts` and `useLanguages`; Extra: Enhanced App.vue to include dynamic company info and language fetching on mount; Added scoped styles for new components and pages.
21 lines
No EOL
535 B
JavaScript
21 lines
No EOL
535 B
JavaScript
import {useMutation} from "@vue/apollo-composable";
|
|
import {GET_WISHLIST} from "@/graphql/queries/wishlist.js";
|
|
import {useWishlistStore} from "@/stores/wishlist.js";
|
|
|
|
export function useWishlist() {
|
|
const wishlistStore = useWishlistStore()
|
|
|
|
const { mutate: wishlistMutation } = useMutation(GET_WISHLIST);
|
|
|
|
async function getWishlist() {
|
|
const response = await wishlistMutation();
|
|
|
|
if (!response.errors) {
|
|
wishlistStore.setWishlist(response.data.wishlists.edges[0].node)
|
|
}
|
|
}
|
|
|
|
return {
|
|
getWishlist
|
|
};
|
|
} |