mirror of
https://github.com/yangjian102621/geekai.git
synced 2025-09-17 16:56:38 +08:00
feat(ui): 无权限判断
This commit is contained in:
parent
ac5e67ea73
commit
f01c764589
10
new-ui/projects/admin/env.d.ts
vendored
10
new-ui/projects/admin/env.d.ts
vendored
@ -5,13 +5,5 @@ declare module "*.vue" {
|
|||||||
const component: DefineComponent<{}, {}, any>;
|
const component: DefineComponent<{}, {}, any>;
|
||||||
export default component;
|
export default component;
|
||||||
}
|
}
|
||||||
import 'vue-router'
|
|
||||||
declare module 'vue-router' {
|
|
||||||
interface RouteMeta {
|
|
||||||
title?: string
|
|
||||||
icon?: any
|
|
||||||
permission?: boolean | string | string[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare const __AUTH_KEY: string;
|
declare const __AUTH_KEY: string;
|
||||||
|
@ -17,10 +17,17 @@ instance.interceptors.request.use((config) => {
|
|||||||
instance.interceptors.response.use(
|
instance.interceptors.response.use(
|
||||||
(response) => {
|
(response) => {
|
||||||
const { data }: { data: BaseResponse<unknown> } = response
|
const { data }: { data: BaseResponse<unknown> } = response
|
||||||
if (data && typeof data === "object" && data.code !== 0) {
|
if (data && typeof data === "object" && data.code > 0) {
|
||||||
if (data.code === 400) {
|
switch (data.code) {
|
||||||
localStorage.removeItem(__AUTH_KEY);
|
case 400: {
|
||||||
router.push({ name: "Login" })
|
localStorage.removeItem(__AUTH_KEY);
|
||||||
|
router.push({ name: "Login" })
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 403: {
|
||||||
|
router.replace({ name: "403" })
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Notification.error(data.message ?? '未知错误')
|
Notification.error(data.message ?? '未知错误')
|
||||||
}
|
}
|
||||||
|
8
new-ui/projects/admin/src/router/type.d.ts
vendored
Normal file
8
new-ui/projects/admin/src/router/type.d.ts
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import 'vue-router'
|
||||||
|
declare module 'vue-router' {
|
||||||
|
interface RouteMeta {
|
||||||
|
title?: string
|
||||||
|
icon?: any
|
||||||
|
permission?: boolean | string | string[]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user