提交 33a5804e 编写于 作者: D DebugIsFalse

Merge branch 'main' of gitcode.com:git_bot/ai-fe

const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run' const BASE_URL = 'https://gpu-pod656e861afe3d944d6b3ce77e-7862.node.inscode.run'
const request = async (url, options = {}) => { const request = async (url, options = {}) => {
const token = useCookie('token') const token = useCookie('token')
const fullUrl = BASE_URL + url const fullUrl = BASE_URL + url
...@@ -20,6 +19,21 @@ const request = async (url, options = {}) => { ...@@ -20,6 +19,21 @@ const request = async (url, options = {}) => {
}, },
onResponseError({ request, response, options }) { onResponseError({ request, response, options }) {
const status = response.status
if (process.client && (status === 401 || status === 403)) {
let title
if (status === 401) title = '抱歉,您没有权限操作'
else if (status === 403) title = '抱歉,您没有权限访问当前内容'
nextTick(() => {
const toast = useToast()
toast.add({
icon: 'i-heroicons-exclamation-triangle-20-solid',
timeout: 3000,
title: title,
color: 'red'
})
})
}
// 处理响应错误 // 处理响应错误
console.log('[ResponseError]', request) console.log('[ResponseError]', request)
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册