generated from SocialGouv/template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from SocialGouv/feat/ajout-demande-bo
feat(ajout): branchement bo
- Loading branch information
Showing
10 changed files
with
418 additions
and
52 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { ApolloClient, InMemoryCache, createHttpLink } from "@apollo/client" | ||
import { setContext } from '@apollo/client/link/context'; | ||
|
||
const API_URL = process.env.NEXT_PUBLIC_API_URL | ||
|
||
const httpLink = createHttpLink({ | ||
uri: `${API_URL}/graphql?nocache`, | ||
}); | ||
|
||
const authLink = setContext((_, { headers }) => { | ||
const token = localStorage.getItem("token"); | ||
return { | ||
headers: { | ||
...headers, | ||
authorization: token ? `Bearer ${token}` : "", | ||
} | ||
} | ||
}); | ||
|
||
export const client = new ApolloClient({ | ||
cache: new InMemoryCache(), | ||
headers: { | ||
"content-type": "application/json", | ||
}, | ||
link: authLink.concat(httpLink), | ||
}) |
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
Oops, something went wrong.