fix: 管理端所有认证接口统一使用 /api/v1/admin/auth/* 路由
后端: - 新增管理端认证路由组 /api/v1/admin/auth/(JWT + admin 角色双重检查) - 管理端登出:POST /api/v1/admin/auth/logout - 管理端获取个人信息:GET /api/v1/admin/auth/profile - 管理端更新个人信息:PUT /api/v1/admin/auth/profile - 管理端修改密码:PUT /api/v1/admin/auth/password 前端: - admin/src/api/auth.js 所有接口全部改为 /api/v1/admin/auth/* - 登出和获取个人信息不再使用前台的 /api/v1/auth/ 路由 Made-with: Cursor
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* 管理后台认证 API
|
||||
*
|
||||
* 登录接口:/api/v1/admin/auth/login(管理端专用,后端检查管理员角色)
|
||||
* 其他接口:/api/v1/auth/*(与前台共用,通过 JWT 中的 client_type 区分)
|
||||
* 所有接口均使用管理端专属路由:/api/v1/admin/auth/*
|
||||
* 后端对管理端路由做 JWT + admin 角色双重检查
|
||||
*
|
||||
* Token 在 Redis 中按 client_type 隔离存储:
|
||||
* - 管理端:echo:auth:token:admin:{user_id}
|
||||
@@ -23,16 +23,16 @@ export const login = (data) => {
|
||||
|
||||
/**
|
||||
* 管理员登出
|
||||
* POST /api/v1/auth/logout
|
||||
* POST /api/v1/admin/auth/logout
|
||||
*/
|
||||
export const logout = () => {
|
||||
return request.post('/api/v1/auth/logout')
|
||||
return request.post('/api/v1/admin/auth/logout')
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取管理员个人信息
|
||||
* GET /api/v1/auth/profile
|
||||
* GET /api/v1/admin/auth/profile
|
||||
*/
|
||||
export const getProfile = () => {
|
||||
return request.get('/api/v1/auth/profile')
|
||||
return request.get('/api/v1/admin/auth/profile')
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
- Loading 状态防重复提交
|
||||
- 登录成功跳转仪表盘
|
||||
|
||||
对应 API:POST /api/v1/auth/login
|
||||
对应 API:POST /api/v1/admin/auth/login
|
||||
-->
|
||||
<template>
|
||||
<div class="login-page">
|
||||
|
||||
Reference in New Issue
Block a user