send Api Ok

This commit is contained in:
saeid_01
2019-04-16 11:18:38 +04:30
parent 4c286bfbc0
commit 655d6bf800
29 changed files with 5100 additions and 3358 deletions
+11 -5
View File
@@ -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 }