fix: formik bugs and gql upload
This commit is contained in:
parent
3de7ae2fe9
commit
9baa16c824
9 changed files with 56 additions and 64 deletions
|
|
@ -3,7 +3,7 @@ import { InMemoryCache } from 'apollo-cache-inmemory'
|
|||
import { ApolloClient } from 'apollo-client'
|
||||
import { ApolloLink } from 'apollo-link'
|
||||
import { onError } from 'apollo-link-error'
|
||||
import { HttpLink } from 'apollo-link-http'
|
||||
import { createUploadLink } from 'apollo-upload-client'
|
||||
import React, { useContext } from 'react'
|
||||
import { useHistory, useLocation } from 'react-router-dom'
|
||||
|
||||
|
|
@ -15,6 +15,16 @@ const URI =
|
|||
const ALT_URI =
|
||||
process.env.NODE_ENV === 'development' ? 'http://localhost:4001' : ''
|
||||
|
||||
const uploadLink = createUploadLink({
|
||||
credentials: 'include',
|
||||
uri: `${URI}/graphql`
|
||||
})
|
||||
|
||||
const uploadLinkALT = createUploadLink({
|
||||
credentials: 'include',
|
||||
uri: `${ALT_URI}/graphql`
|
||||
})
|
||||
|
||||
const getClient = (history, location, getUserData, setUserData, setRole) =>
|
||||
new ApolloClient({
|
||||
link: ApolloLink.from([
|
||||
|
|
@ -48,14 +58,8 @@ const getClient = (history, location, getUserData, setUserData, setRole) =>
|
|||
}),
|
||||
ApolloLink.split(
|
||||
operation => operation.getContext().clientName === 'pazuz',
|
||||
new HttpLink({
|
||||
credentials: 'include',
|
||||
uri: `${ALT_URI}/graphql`
|
||||
}),
|
||||
new HttpLink({
|
||||
credentials: 'include',
|
||||
uri: `${URI}/graphql`
|
||||
})
|
||||
uploadLink,
|
||||
uploadLinkALT
|
||||
)
|
||||
]),
|
||||
cache: new InMemoryCache(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue