ыыы
This commit is contained in:
parent
220799d853
commit
01056a87b5
1 changed files with 15 additions and 1 deletions
|
|
@ -1,7 +1,21 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import { useAuthStore } from '../store/auth'
|
import { useAuthStore } from '../store/auth'
|
||||||
|
|
||||||
export const api = axios.create({ baseURL: '/' })
|
export const api = axios.create({
|
||||||
|
baseURL: '/',
|
||||||
|
paramsSerializer: (params) => {
|
||||||
|
const sp = new URLSearchParams()
|
||||||
|
for (const [key, val] of Object.entries(params)) {
|
||||||
|
if (val === undefined || val === null) continue
|
||||||
|
if (Array.isArray(val)) {
|
||||||
|
val.forEach((v) => sp.append(key, String(v)))
|
||||||
|
} else {
|
||||||
|
sp.append(key, String(val))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sp.toString()
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Inject access token on every request
|
// Inject access token on every request
|
||||||
api.interceptors.request.use((config) => {
|
api.interceptors.request.use((config) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue