File tree 1 file changed +6
-6
lines changed
packages/vue-apollo-composable/src
1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -4,14 +4,14 @@ import ApolloClient from 'apollo-client'
4
4
export const DefaultApolloClient = Symbol ( 'default-apollo-client' )
5
5
export const ApolloClients = Symbol ( 'apollo-clients' )
6
6
7
+ type ClientId = string
8
+ type ClientDict < T > = Record < ClientId , ApolloClient < T > >
9
+
7
10
export interface UseApolloClientReturn < TCacheShape > {
8
- resolveClient : ( clientId ?: string ) => ApolloClient < TCacheShape >
11
+ resolveClient : ( clientId ?: ClientId ) => ApolloClient < TCacheShape >
9
12
readonly client : ApolloClient < TCacheShape >
10
13
}
11
14
12
- type ClientId = string
13
- type ClientDict < T > = Record < ClientId , ApolloClient < T > >
14
-
15
15
function resolveDefaultClient < T > ( providedApolloClients : ClientDict < T > , providedApolloClient : ApolloClient < T > ) : ApolloClient < T > {
16
16
const resolvedClient = providedApolloClients ?
17
17
providedApolloClients . default
@@ -37,8 +37,8 @@ export function useApolloClient<TCacheShape = any>(clientId?: ClientId): UseApol
37
37
const providedApolloClients : ClientDict < TCacheShape > = inject ( ApolloClients , null )
38
38
const providedApolloClient : ApolloClient < TCacheShape > = inject ( DefaultApolloClient , null )
39
39
40
- function resolveClient ( ) {
41
- if ( clientId ) {
40
+ function resolveClient ( id : ClientId = clientId ) {
41
+ if ( id ) {
42
42
return resolveClientWithId ( providedApolloClients , clientId )
43
43
}
44
44
return resolveDefaultClient ( providedApolloClients , providedApolloClient )
You can’t perform that action at this time.
0 commit comments