完善备注面板
This commit is contained in:
@@ -3,9 +3,18 @@ import { useEffect, useState } from 'react';
|
||||
import { getVerificationCodeImage, loginByPassword } from '../../api';
|
||||
import { Button, Input } from '../ui';
|
||||
|
||||
interface LoginSuccessPayload {
|
||||
userId: string;
|
||||
userName: string;
|
||||
accessToken: string;
|
||||
refreshToken: string;
|
||||
roles: string;
|
||||
username: string;
|
||||
}
|
||||
|
||||
interface LoginModalProps {
|
||||
onClose: () => void;
|
||||
onLoginSuccess?: (userName: string) => void;
|
||||
onLoginSuccess?: (payload: LoginSuccessPayload) => void;
|
||||
}
|
||||
|
||||
const APP_ID = 'b2b49e91d21446aeb14579930f732985';
|
||||
@@ -72,7 +81,14 @@ export const LoginModal = ({ onClose, onLoginSuccess }: LoginModalProps) => {
|
||||
verification_code_key: imgCodeKey,
|
||||
});
|
||||
if (res.Status === 200 && res.Data?.access_token) {
|
||||
onLoginSuccess?.(res.Data.user_name || username.trim());
|
||||
onLoginSuccess?.({
|
||||
userId: res.Data.user_id,
|
||||
userName: res.Data.user_name,
|
||||
accessToken: res.Data.access_token,
|
||||
refreshToken: res.Data.refresh_token,
|
||||
roles: res.Data.roles,
|
||||
username: username.trim(),
|
||||
});
|
||||
onClose();
|
||||
} else {
|
||||
setError(res.Message || '登录失败');
|
||||
|
||||
Reference in New Issue
Block a user