-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Merge pull request #192 from glific/feature/Authentication"
- Loading branch information
Showing
12 changed files
with
65 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,18 @@ | ||
import { ApolloClient, InMemoryCache, createHttpLink, split, from } from '@apollo/client'; | ||
import { ApolloClient, InMemoryCache, createHttpLink, split } from '@apollo/client'; | ||
import absinthe from './absinthe'; | ||
import { URI } from '.'; | ||
import { setContext } from '@apollo/link-context'; | ||
|
||
const subscribe = require('@jumpn/utils-graphql'); | ||
|
||
const gqlClient = (auth_token: string | null) => { | ||
const authLink = setContext((_, { headers }) => { | ||
return { | ||
headers: { | ||
...headers, | ||
Authorization: auth_token ? auth_token : '', | ||
}, | ||
}; | ||
}); | ||
const link = split( | ||
(operation) => subscribe.hasSubscription(operation.query), | ||
absinthe, | ||
createHttpLink({ uri: URI }) | ||
); | ||
|
||
const httpLink = createHttpLink({ uri: URI }); | ||
const gqlClient = new ApolloClient({ | ||
link, | ||
cache: new InMemoryCache(), | ||
}); | ||
|
||
const link = split( | ||
(operation) => subscribe.hasSubscription(operation.query), | ||
absinthe, | ||
authLink.concat(httpLink) | ||
); | ||
|
||
return new ApolloClient({ | ||
link, | ||
cache: new InMemoryCache(), | ||
}); | ||
}; | ||
export default gqlClient; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.