- change privateInboxGraphQLClient options
This commit is contained in:
parent
04efdd368e
commit
b83005fbaa
|
@ -99,7 +99,7 @@ export const NotificationsProvider = (props: { children: JSX.Element }) => {
|
|||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: 'Bearer ' + getToken()
|
||||
Authorization: getToken()
|
||||
},
|
||||
onmessage(event) {
|
||||
const m: SSEMessage = JSON.parse(event.data)
|
||||
|
|
|
@ -48,5 +48,15 @@ export const privateGraphQLClient = createClient(options)
|
|||
|
||||
export const privateInboxGraphQLClient = createClient({
|
||||
...options,
|
||||
fetchOptions: () => {
|
||||
// localStorage is the source of truth for now
|
||||
// to change token call setToken, for example after login
|
||||
const token = localStorage.getItem(TOKEN_LOCAL_STORAGE_KEY)
|
||||
if (!token) {
|
||||
console.error('[privateInboxGraphQLClient] fetchOptions: token is null!')
|
||||
}
|
||||
const headers = { Authorization: token }
|
||||
return { headers }
|
||||
},
|
||||
url: 'https://chat.discours.io'
|
||||
})
|
||||
|
|
|
@ -373,6 +373,7 @@ export const apiClient = {
|
|||
export const inboxClient = {
|
||||
loadChats: async (options: QueryLoadChatsArgs): Promise<Chat[]> => {
|
||||
const resp = await privateInboxGraphQLClient.query(myChats, options).toPromise()
|
||||
console.log('!!! resp:', resp)
|
||||
return resp.data.loadChats.chats
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
export const isDev = import.meta.env.MODE === 'development'
|
||||
|
||||
const defaultApiUrl = 'https://testapi.discours.io'
|
||||
export const apiBaseUrl = import.meta.env.PUBLIC_API_URL || defaultApiUrl
|
||||
// export const apiBaseUrl = import.meta.env.PUBLIC_API_URL || defaultApiUrl
|
||||
export const apiBaseUrl = 'https://v2.discours.io'
|
||||
|
||||
export const SENTRY_DSN = import.meta.env.PUBLIC_SENTRY_DSN || ''
|
||||
|
|
Loading…
Reference in New Issue
Block a user