feat: add apollolink split to query both lamassu and pazuz apollo servers

feat: integrate accounting with pazuz related screens
This commit is contained in:
Sérgio Salgado 2021-10-12 19:03:41 +01:00
parent 16513a8238
commit 9260e4a698
5 changed files with 314 additions and 193 deletions

View file

@ -12,6 +12,9 @@ import AppContext from 'src/AppContext'
const URI =
process.env.NODE_ENV === 'development' ? 'https://localhost:8070' : ''
const ALT_URI =
process.env.NODE_ENV === 'development' ? 'http://localhost:4001' : ''
const getClient = (history, location, getUserData, setUserData, setRole) =>
new ApolloClient({
link: ApolloLink.from([
@ -43,10 +46,17 @@ const getClient = (history, location, getUserData, setUserData, setRole) =>
return response
})
}),
new HttpLink({
credentials: 'include',
uri: `${URI}/graphql`
})
ApolloLink.split(
operation => operation.getContext().clientName === 'pazuz',
new HttpLink({
credentials: 'include',
uri: `${ALT_URI}/graphql`
}),
new HttpLink({
credentials: 'include',
uri: `${URI}/graphql`
})
)
]),
cache: new InMemoryCache(),
defaultOptions: {