Fixes: 1) Add missing type annotations for `isSearchActive` in `useSearchUi.ts`; 2) Resolve improper conditional rendering in empty state templates across multiple files; 3) Remove unnecessary `console.log` calls in `goTo` function; Extra: 1) Update SCSS styles including border thickness, colors, and padding tweaks; 2) Refactor `loader.vue` to use `<span>` instead of `<li>` for dots and adjust size; 3) Clean up obsolete TODOs, comments, and unused imports.
49 lines
No EOL
1.4 KiB
TypeScript
49 lines
No EOL
1.4 KiB
TypeScript
import { from, ApolloLink } from '@apollo/client/core';
|
|
import { onError } from '@apollo/client/link/error';
|
|
import { setContext } from '@apollo/client/link/context';
|
|
import { provideApolloClient } from '@vue/apollo-composable';
|
|
import createUploadLink from "apollo-upload-client/createUploadLink.mjs";
|
|
import { useAppConfig } from '~/composables/config';
|
|
|
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
const runtime = useRuntimeConfig();
|
|
const localeCookie = useCookie(useAppConfig().COOKIES_LOCALE_KEY);
|
|
const token = useCookie(useAppConfig().COOKIES_ACCESS_TOKEN_KEY).value || '';
|
|
const { $apollo } = nuxtApp as any;
|
|
|
|
const errorLink = onError((err) => {
|
|
nuxtApp.callHook('apollo:error', err);
|
|
});
|
|
|
|
const authLink = setContext(async (_, { headers }) => {
|
|
const hdrs: Record<string,string> = {
|
|
...headers,
|
|
'Accept-Language': localeCookie.value || 'en-gb'
|
|
};
|
|
|
|
if (token) {
|
|
hdrs['X-EVIBES-AUTH'] = `Bearer ${token}`;
|
|
}
|
|
|
|
return { headers: hdrs };
|
|
});
|
|
|
|
const customLink = new ApolloLink((operation, forward) => {
|
|
return forward(operation).map((data) => {
|
|
return data;
|
|
});
|
|
});
|
|
|
|
const httpLink = createUploadLink({
|
|
uri: `https://api.${runtime.public.evibesBaseDomain}/graphql/`
|
|
});
|
|
|
|
$apollo.defaultClient.setLink(from([
|
|
errorLink,
|
|
authLink,
|
|
customLink,
|
|
httpLink,
|
|
]));
|
|
|
|
provideApolloClient($apollo.defaultClient);
|
|
}); |