Browse Source

Merge branch 'master' into stage

pull/21/head
Vitalik 9 months ago
parent
commit
ba1f8845ac
  1. 10
      src/api/auth/requests.ts
  2. 4
      src/api/http.service.ts

10
src/api/auth/requests.ts

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
import http from '../http.service'
import http, { axiosInstance } from '../http.service'
import { ApiResponse } from '../http.types'
import {
IFinishLoginPayload,
@ -23,13 +23,7 @@ export const finishLogin = ( @@ -23,13 +23,7 @@ export const finishLogin = (
export const resetSessionReq = (
params: IRefreshTokenPayload,
): ApiResponse<IAuthSuccessResponse> => {
return http.post<IAuthSuccessResponse>(
'auth/refresh-token',
params,
null,
null,
false,
)
return axiosInstance.post('/app/auth/refresh-token', params)
}
export const signOut = (

4
src/api/http.service.ts

@ -11,7 +11,7 @@ import { UserFingerprintGenerator } from '@/shared/helpers/fingerprint.helper' @@ -11,7 +11,7 @@ import { UserFingerprintGenerator } from '@/shared/helpers/fingerprint.helper'
const store = () => GlobalContainerService.get('store')
const axiosInstance = axios.create({
export const axiosInstance = axios.create({
baseURL: config.baseUrl,
// headers: {
// 'Content-Type': 'application/json',
@ -60,7 +60,7 @@ const request = async <T>( @@ -60,7 +60,7 @@ const request = async <T>(
return request(func, retryCount + 1)
}
if (getErrorCode(e) === 401 && tryAgainOnError) {
if (getErrorCode(e) === 401 && tryAgainOnError && retryCount <= 2) {
await authService.refreshSession()
return (await func()) as any as AxiosResponse
}

Loading…
Cancel
Save