
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
@alexlit/apollo-vue-kit
Advanced tools
Sample nuxt.js plugin (TypeScript + Apollo REST link)
import {
ApolloClient,
ApolloLink,
buildAxiosFetch,
InMemoryCache,
onError,
RestLink,
VueApollo,
} from '@alexlit/apollo-vue-kit';
import { formDataSerializer } from '@alexlit/apollo-vue-kit/serializers';
import type { Plugin } from '@nuxt/types';
import Vue from 'vue';
const API_HOST = 'https://example.com';
Vue.use(VueApollo);
/**
* @param context
* @param context.app
* @param context.$axios
*/
const vueApollo: Plugin = ({ app, $axios }) => {
/**
* Error
*/
const errorLink = onError(({ graphQLErrors, networkError }) => {
if (graphQLErrors) {
// silent
}
if (
networkError &&
`${networkError}` !== 'TypeError: forward is not a function'
) {
const { response, statusCode, result } = networkError as any;
console.error(
'[Apollo.plugin::onError.networkError]: ',
`${networkError}`,
{
response,
statusCode,
result,
},
);
}
});
/**
* Cache
*/
const cache = new InMemoryCache();
/**
* Rest
*/
const restLink = new RestLink({
uri: API_HOST,
/**
* Use axios plugin instead of vanilla fetch
*
* @param uri
* @param options
*/
customFetch: (uri, options) => {
return buildAxiosFetch($axios, (config) => {
/**
* Apollo formed header, for example, when using the 'formDataSerializer' parameter
*/
const apolloHeaders: Record<string, string> = Object.fromEntries(
(options.headers as any).entries(),
);
config.headers = { ...config.headers, ...apolloHeaders };
return config;
})(uri, options);
},
bodySerializers: {
formData: formDataSerializer,
},
});
/**
* Client
*/
const defaultClient = new ApolloClient({
link: ApolloLink.from([errorLink, restLink]),
typeDefs: [],
resolvers: {},
cache,
});
/**
* Provider
*/
const apolloProvider = new VueApollo({
defaultClient,
});
app.apolloProvider = apolloProvider;
};
export default vueApollo;
FAQs
Apollo Vue Kit
The npm package @alexlit/apollo-vue-kit receives a total of 2 weekly downloads. As such, @alexlit/apollo-vue-kit popularity was classified as not popular.
We found that @alexlit/apollo-vue-kit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.