Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
setup: () => {
const fromMount = inject('fromMount')
const setInSetup = ref('created')
return {
fromMount,
setInSetup
}
}
})
export const useNotifications = () => inject(key)
export function useApolloClient (clientId: string = null) {
const providedApolloClients: { [key: string]: ApolloClient } = inject(ApolloClients, null)
const providedApolloClient: ApolloClient = inject(DefaultApolloClient, null)
function resolveClient (clientId: string = null): ApolloClient {
let resolvedClient
if (clientId) {
if (!providedApolloClients) {
throw new Error(`No apolloClients injection found, tried to resolve '${clientId}' clientId`)
}
resolvedClient = providedApolloClients[clientId]
} else {
clientId = 'default'
if (providedApolloClients) {
resolvedClient = providedApolloClients.default
} else {
resolvedClient = providedApolloClient
}
}
setup () {
const required = inject('required')
return {
required
}
}
}
export const useStore = () => inject(key) as Hook
export function useApolloClient (clientId: string = null) {
const providedApolloClients: { [key: string]: ApolloClient } = inject(ApolloClients, null)
const providedApolloClient: ApolloClient = inject(DefaultApolloClient, null)
function resolveClient (clientId: string = null): ApolloClient {
let resolvedClient
if (clientId) {
if (!providedApolloClients) {
throw new Error(`No apolloClients injection found, tried to resolve '${clientId}' clientId`)
}
resolvedClient = providedApolloClients[clientId]
} else {
clientId = 'default'
if (providedApolloClients) {
resolvedClient = providedApolloClients.default
} else {
resolvedClient = providedApolloClient
}