File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ export const authService = {
3636 console . warn ( "Session verification failed, HTTP status code:" , response . status ) ;
3737
3838 // HTTP 401 means the token is expired or invalid
39- if ( response . status === STATUS_CODES . UNAUTHORIZED_HTTP ) {
39+ if ( response . status === 401 ) {
4040 return null ;
4141 }
4242
@@ -84,7 +84,7 @@ export const authService = {
8484 try {
8585 const response = await fetch ( API_ENDPOINTS . user . serviceHealth , { method : 'GET' } ) ;
8686
87- return response . status === STATUS_CODES . SUCCESS ;
87+ return response . status === 200 ;
8888 } catch ( error ) {
8989 return false ;
9090 }
Original file line number Diff line number Diff line change 22 * 认证相关类型与常量定义
33 */
44export const STATUS_CODES = {
5- SUCCESS : 200 ,
5+ // 成功状态码
6+ SUCCESS : 200 , // 成功
67
7- UNAUTHORIZED_HTTP : 401 ,
8-
9- INVALID_CREDENTIALS : 1002 ,
10- TOKEN_EXPIRED : 1003 ,
11- UNAUTHORIZED : 1004 ,
12- INVALID_INPUT : 1006 ,
13- AUTH_SERVICE_UNAVAILABLE : 1007 ,
14-
15- SERVER_ERROR : 1005 ,
8+ // 客户端错误状态码
9+ INVALID_CREDENTIALS : 1002 , // 无效的登录凭证
10+ TOKEN_EXPIRED : 1003 , // Token已过期
11+ UNAUTHORIZED : 1004 , // 未授权操作
12+ INVALID_INPUT : 1006 , // 无效的输入参数
13+ AUTH_SERVICE_UNAVAILABLE : 1007 , // 认证服务不可用
14+
15+ // 服务器错误状态码
16+ SERVER_ERROR : 1005 , // 服务器内部错误
1617} ;
1718
1819// 本地存储键
You can’t perform that action at this time.
0 commit comments