mirror of
https://github.com/GiriNeko/YesPlayMusic.git
synced 2025-12-16 21:28:06 +00:00
feat: updates
This commit is contained in:
parent
9a52681687
commit
840a5b8e9b
104 changed files with 1645 additions and 13494 deletions
|
|
@ -1,13 +1,7 @@
|
|||
import axios, {
|
||||
AxiosError,
|
||||
AxiosInstance,
|
||||
AxiosRequestConfig,
|
||||
AxiosResponse,
|
||||
} from 'axios'
|
||||
import axios, { AxiosError, AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
|
||||
import { logout } from '../api/hooks/useUser'
|
||||
|
||||
const baseURL = String(
|
||||
import.meta.env.DEV ? '/netease' : import.meta.env.VITE_APP_NETEASE_API_URL
|
||||
)
|
||||
const baseURL = String(import.meta.env.DEV ? '/netease' : import.meta.env.VITE_APP_NETEASE_API_URL)
|
||||
|
||||
const service: AxiosInstance = axios.create({
|
||||
baseURL,
|
||||
|
|
@ -25,6 +19,12 @@ service.interceptors.response.use(
|
|||
return res
|
||||
},
|
||||
(error: AxiosError) => {
|
||||
const { response } = error
|
||||
const data = response?.data as any
|
||||
if (data?.code === 301 && data?.message === '未登录') {
|
||||
console.log('未登录')
|
||||
logout()
|
||||
}
|
||||
return Promise.reject(error)
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue