Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-capstone-design1
/
Triz_Project1
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
1
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
sdy
2020-07-17 15:28:42 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
7012a1a1a4bf302b731f07d4886e65474c1862e6
7012a1a1
1 parent
87865501
update cache
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
front/src/Apollo/Client.js
front/src/Apollo/Client.js
View file @
7012a1a
...
...
@@ -7,7 +7,7 @@ import { ApolloLink, split } from "apollo-link";
import
{
getMainDefinition
}
from
"apollo-utilities"
;
import
{
withClientState
}
from
"apollo-link-state"
;
import
{
setContext
}
from
"apollo-link-context"
;
import
{
resolvers
,
default
s
}
from
"./ClientState"
;
import
{
resolvers
,
typeDef
s
}
from
"./ClientState"
;
const
httpLink
=
new
HttpLink
({
uri
:
"http://localhost:4000"
,
...
...
@@ -25,10 +25,18 @@ const setAuthorizationLink = setContext((request, previousContext) => ({
}));
const
clientState
=
withClientState
({
default
s
,
typeDef
s
,
resolvers
,
});
const
cache
=
new
InMemoryCache
();
cache
.
writeData
({
data
:
{
isLoggedIn
:
Boolean
(
localStorage
.
getItem
(
"token"
)
||
false
),
},
});
const
client
=
new
ApolloClient
({
link
:
ApolloLink
.
from
([
onError
(({
graphQLErrors
,
networkError
})
=>
{
...
...
@@ -54,6 +62,6 @@ const client = new ApolloClient({
httpLink
),
]),
cache
:
new
InMemoryCache
()
,
cache
,
});
export
default
client
;
...
...
Please
register
or
login
to post a comment