mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 11:01:07 +03:30
send Api Ok
This commit is contained in:
+11
-5
@@ -1,6 +1,7 @@
|
||||
import axios from 'axios'
|
||||
import { TokenService } from './storage.service'
|
||||
import store from '@/store'
|
||||
import qs from 'qs';
|
||||
|
||||
const ApiService = {
|
||||
|
||||
@@ -44,7 +45,12 @@ const ApiService = {
|
||||
* - password
|
||||
**/
|
||||
customRequest(data) {
|
||||
return axios(data)
|
||||
for (let d in data) {
|
||||
if (typeof data[d] == 'object') {
|
||||
data[d] = qs.stringify(data[d]);
|
||||
}
|
||||
}
|
||||
return axios(data);
|
||||
},
|
||||
|
||||
_401interceptor: null,
|
||||
@@ -56,10 +62,10 @@ const ApiService = {
|
||||
},
|
||||
async (error) => {
|
||||
if (error.request.status == 401) {
|
||||
if (error.config.url.includes('/auth/login/')) {
|
||||
if (error.config.url.includes('auth/login')) {
|
||||
// Refresh token has failed. Logout the user
|
||||
store.dispatch('auth/logout')
|
||||
throw error
|
||||
store.dispatch('auth/logout');
|
||||
throw error;
|
||||
} else {
|
||||
// Refresh the access token
|
||||
try{
|
||||
@@ -90,4 +96,4 @@ const ApiService = {
|
||||
}
|
||||
|
||||
export default ApiService
|
||||
export { ApiService}
|
||||
export { ApiService }
|
||||
|
||||
Reference in New Issue
Block a user