🐛 fix: exception handling
This commit is contained in:
parent
3b46e4ca16
commit
290523b675
@ -11,9 +11,10 @@ const StatusProvider = ({ children }) => {
|
|||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const loadStatus = useCallback(async () => {
|
const loadStatus = useCallback(async () => {
|
||||||
|
let system_name = '';
|
||||||
|
try {
|
||||||
const res = await API.get('/api/status');
|
const res = await API.get('/api/status');
|
||||||
const { success, data } = res.data;
|
const { success, data } = res.data;
|
||||||
let system_name = '';
|
|
||||||
if (success) {
|
if (success) {
|
||||||
if (!data.chat_link) {
|
if (!data.chat_link) {
|
||||||
delete data.chat_link;
|
delete data.chat_link;
|
||||||
@ -45,6 +46,8 @@ const StatusProvider = ({ children }) => {
|
|||||||
payload: data
|
payload: data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
showError('无法正常连接至服务器!');
|
showError('无法正常连接至服务器!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ API.interceptors.response.use(
|
|||||||
if (error.response?.status === 401) {
|
if (error.response?.status === 401) {
|
||||||
localStorage.removeItem('user');
|
localStorage.removeItem('user');
|
||||||
store.dispatch({ type: LOGIN, payload: null });
|
store.dispatch({ type: LOGIN, payload: null });
|
||||||
window.location.href = '/login';
|
// window.location.href = '/login';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error.response?.data?.message) {
|
if (error.response?.data?.message) {
|
||||||
|
@ -70,6 +70,7 @@ export function showInfo(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getOAuthState() {
|
export async function getOAuthState() {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/oauth/state');
|
const res = await API.get('/api/oauth/state');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -78,6 +79,9 @@ export async function getOAuthState() {
|
|||||||
showError(message);
|
showError(message);
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function onGitHubOAuthClicked(github_client_id, openInNewTab = false) {
|
export async function onGitHubOAuthClicked(github_client_id, openInNewTab = false) {
|
||||||
|
@ -11,6 +11,7 @@ const About = () => {
|
|||||||
|
|
||||||
const displayAbout = async () => {
|
const displayAbout = async () => {
|
||||||
setAbout(localStorage.getItem('about') || '');
|
setAbout(localStorage.getItem('about') || '');
|
||||||
|
try {
|
||||||
const res = await API.get('/api/about');
|
const res = await API.get('/api/about');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -24,6 +25,10 @@ const About = () => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
setAbout('加载关于内容失败...');
|
setAbout('加载关于内容失败...');
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setAbout('加载关于内容失败...');
|
||||||
|
}
|
||||||
|
|
||||||
setAboutLoaded(true);
|
setAboutLoaded(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,6 +30,12 @@ const ForgetPasswordForm = ({ ...others }) => {
|
|||||||
const [disableButton, setDisableButton] = useState(false);
|
const [disableButton, setDisableButton] = useState(false);
|
||||||
const [countdown, setCountdown] = useState(30);
|
const [countdown, setCountdown] = useState(30);
|
||||||
|
|
||||||
|
const handleFailure = (message) => {
|
||||||
|
showError(message);
|
||||||
|
setDisableButton(false);
|
||||||
|
setCountdown(30);
|
||||||
|
};
|
||||||
|
|
||||||
const submit = async (values, { setSubmitting }) => {
|
const submit = async (values, { setSubmitting }) => {
|
||||||
setDisableButton(true);
|
setDisableButton(true);
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
@ -38,15 +44,17 @@ const ForgetPasswordForm = ({ ...others }) => {
|
|||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/reset_password?email=${values.email}&turnstile=${turnstileToken}`);
|
const res = await API.get(`/api/reset_password?email=${values.email}&turnstile=${turnstileToken}`);
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
showSuccess('重置邮件发送成功,请检查邮箱!');
|
showSuccess('重置邮件发送成功,请检查邮箱!');
|
||||||
setSendEmail(true);
|
setSendEmail(true);
|
||||||
} else {
|
} else {
|
||||||
showError(message);
|
handleFailure(message);
|
||||||
setDisableButton(false);
|
}
|
||||||
setCountdown(30);
|
} catch (error) {
|
||||||
|
handleFailure('服务器错误');
|
||||||
}
|
}
|
||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
};
|
};
|
||||||
|
@ -19,6 +19,7 @@ const ResetPasswordForm = () => {
|
|||||||
const [newPassword, setNewPassword] = useState('');
|
const [newPassword, setNewPassword] = useState('');
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
|
try {
|
||||||
const res = await API.post(`/api/user/reset`, inputs);
|
const res = await API.post(`/api/user/reset`, inputs);
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -29,6 +30,9 @@ const ResetPasswordForm = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -171,6 +171,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
|
|||||||
let res;
|
let res;
|
||||||
const modelsStr = values.models.map((model) => model.id).join(',');
|
const modelsStr = values.models.map((model) => model.id).join(',');
|
||||||
values.group = values.groups.join(',');
|
values.group = values.groups.join(',');
|
||||||
|
try {
|
||||||
if (channelId) {
|
if (channelId) {
|
||||||
res = await API.put(`/api/channel/`, { ...values, id: parseInt(channelId), models: modelsStr });
|
res = await API.put(`/api/channel/`, { ...values, id: parseInt(channelId), models: modelsStr });
|
||||||
} else {
|
} else {
|
||||||
@ -186,11 +187,18 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
|
|||||||
setSubmitting(false);
|
setSubmitting(false);
|
||||||
setStatus({ success: true });
|
setStatus({ success: true });
|
||||||
onOk(true);
|
onOk(true);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
setStatus({ success: false });
|
setStatus({ success: false });
|
||||||
showError(message);
|
showError(message);
|
||||||
setErrors({ submit: message });
|
setErrors({ submit: message });
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
setStatus({ success: false });
|
||||||
|
showError(error.message);
|
||||||
|
setErrors({ submit: error.message });
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function initialModel(channelModel) {
|
function initialModel(channelModel) {
|
||||||
@ -213,6 +221,7 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loadChannel = async () => {
|
const loadChannel = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/channel/${channelId}`);
|
let res = await API.get(`/api/channel/${channelId}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -237,6 +246,9 @@ const EditModal = ({ open, channelId, onCancel, onOk }) => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -82,6 +82,7 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
|
|||||||
};
|
};
|
||||||
|
|
||||||
const updateChannelBalance = async () => {
|
const updateChannelBalance = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/channel/update_balance/${item.id}`);
|
const res = await API.get(`/api/channel/update_balance/${item.id}`);
|
||||||
const { success, message, balance } = res.data;
|
const { success, message, balance } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -91,6 +92,9 @@ export default function ChannelTableRow({ item, manageChannel, handleOpenModal,
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDelete = async () => {
|
const handleDelete = async () => {
|
||||||
|
@ -36,6 +36,7 @@ export default function ChannelPage() {
|
|||||||
|
|
||||||
const loadChannels = async (startIdx) => {
|
const loadChannels = async (startIdx) => {
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/channel/?p=${startIdx}`);
|
const res = await API.get(`/api/channel/?p=${startIdx}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -49,6 +50,10 @@ export default function ChannelPage() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -70,6 +75,7 @@ export default function ChannelPage() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/channel/search?keyword=${searchKeyword}`);
|
const res = await API.get(`/api/channel/search?keyword=${searchKeyword}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -78,6 +84,9 @@ export default function ChannelPage() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error);
|
||||||
|
}
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,6 +98,8 @@ export default function ChannelPage() {
|
|||||||
const url = '/api/channel/';
|
const url = '/api/channel/';
|
||||||
let data = { id };
|
let data = { id };
|
||||||
let res;
|
let res;
|
||||||
|
|
||||||
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
res = await API.delete(url + id);
|
res = await API.delete(url + id);
|
||||||
@ -123,6 +134,9 @@ export default function ChannelPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理刷新
|
// 处理刷新
|
||||||
@ -132,6 +146,7 @@ export default function ChannelPage() {
|
|||||||
|
|
||||||
// 处理测试所有启用渠道
|
// 处理测试所有启用渠道
|
||||||
const testAllChannels = async () => {
|
const testAllChannels = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/channel/test`);
|
const res = await API.get(`/api/channel/test`);
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -139,10 +154,14 @@ export default function ChannelPage() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理删除所有禁用渠道
|
// 处理删除所有禁用渠道
|
||||||
const deleteAllDisabledChannels = async () => {
|
const deleteAllDisabledChannels = async () => {
|
||||||
|
try {
|
||||||
const res = await API.delete(`/api/channel/disabled`);
|
const res = await API.delete(`/api/channel/disabled`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -151,11 +170,15 @@ export default function ChannelPage() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理更新所有启用渠道余额
|
// 处理更新所有启用渠道余额
|
||||||
const updateAllChannelsBalance = async () => {
|
const updateAllChannelsBalance = async () => {
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/channel/update_balance`);
|
const res = await API.get(`/api/channel/update_balance`);
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -163,6 +186,10 @@ export default function ChannelPage() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ const Dashboard = () => {
|
|||||||
const [users, setUsers] = useState([]);
|
const [users, setUsers] = useState([]);
|
||||||
|
|
||||||
const userDashboard = async () => {
|
const userDashboard = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/user/dashboard');
|
const res = await API.get('/api/user/dashboard');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -32,9 +33,13 @@ const Dashboard = () => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadUser = async () => {
|
const loadUser = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/user/self`);
|
let res = await API.get(`/api/user/self`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -42,6 +47,9 @@ const Dashboard = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -9,6 +9,7 @@ const Home = () => {
|
|||||||
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
|
const [homePageContentLoaded, setHomePageContentLoaded] = useState(false);
|
||||||
const [homePageContent, setHomePageContent] = useState('');
|
const [homePageContent, setHomePageContent] = useState('');
|
||||||
const displayNotice = async () => {
|
const displayNotice = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/notice');
|
const res = await API.get('/api/notice');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -21,10 +22,14 @@ const Home = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const displayHomePageContent = async () => {
|
const displayHomePageContent = async () => {
|
||||||
setHomePageContent(localStorage.getItem('home_page_content') || '');
|
setHomePageContent(localStorage.getItem('home_page_content') || '');
|
||||||
|
try {
|
||||||
const res = await API.get('/api/home_page_content');
|
const res = await API.get('/api/home_page_content');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -39,6 +44,9 @@ const Home = () => {
|
|||||||
setHomePageContent('加载首页内容失败...');
|
setHomePageContent('加载首页内容失败...');
|
||||||
}
|
}
|
||||||
setHomePageContentLoaded(true);
|
setHomePageContentLoaded(true);
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -47,6 +47,8 @@ export default function Log() {
|
|||||||
delete query.username;
|
delete query.username;
|
||||||
delete query.channel;
|
delete query.channel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await API.get(url, { params: query });
|
const res = await API.get(url, { params: query });
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -60,6 +62,10 @@ export default function Log() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ const validationSchema = Yup.object().shape({
|
|||||||
email_verification_code: Yup.string().required('验证码不能为空')
|
email_verification_code: Yup.string().required('验证码不能为空')
|
||||||
});
|
});
|
||||||
|
|
||||||
const EmailModal = ({ open, handleClose, turnstileToken }) => {
|
const EmailModal = ({ open, handleClose, turnstileToken, turnstileEnabled }) => {
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const [countdown, setCountdown] = useState(30);
|
const [countdown, setCountdown] = useState(30);
|
||||||
const [disableButton, setDisableButton] = useState(false);
|
const [disableButton, setDisableButton] = useState(false);
|
||||||
@ -36,6 +36,7 @@ const EmailModal = ({ open, handleClose, turnstileToken }) => {
|
|||||||
const submit = async (values, { setErrors, setStatus, setSubmitting }) => {
|
const submit = async (values, { setErrors, setStatus, setSubmitting }) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/oauth/email/bind?email=${values.email}&code=${values.email_verification_code}`);
|
const res = await API.get(`/api/oauth/email/bind?email=${values.email}&code=${values.email_verification_code}`);
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -47,6 +48,9 @@ const EmailModal = ({ open, handleClose, turnstileToken }) => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
setErrors({ submit: message });
|
setErrors({ submit: message });
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -69,7 +73,7 @@ const EmailModal = ({ open, handleClose, turnstileToken }) => {
|
|||||||
showError('请输入邮箱');
|
showError('请输入邮箱');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (turnstileToken === '') {
|
if (turnstileEnabled && turnstileToken === '') {
|
||||||
showError('请稍后几秒重试,Turnstile 正在检查用户环境!');
|
showError('请稍后几秒重试,Turnstile 正在检查用户环境!');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -168,5 +172,6 @@ export default EmailModal;
|
|||||||
EmailModal.propTypes = {
|
EmailModal.propTypes = {
|
||||||
open: PropTypes.bool,
|
open: PropTypes.bool,
|
||||||
handleClose: PropTypes.func,
|
handleClose: PropTypes.func,
|
||||||
turnstileToken: PropTypes.string
|
turnstileToken: PropTypes.string,
|
||||||
|
turnstileEnabled: PropTypes.bool
|
||||||
};
|
};
|
||||||
|
@ -59,6 +59,7 @@ export default function Profile() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadUser = async () => {
|
const loadUser = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/user/self`);
|
let res = await API.get(`/api/user/self`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -66,6 +67,9 @@ export default function Profile() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const bindWeChat = async (code) => {
|
const bindWeChat = async (code) => {
|
||||||
@ -84,6 +88,7 @@ export default function Profile() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const generateAccessToken = async () => {
|
const generateAccessToken = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/user/token');
|
const res = await API.get('/api/user/token');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -93,8 +98,9 @@ export default function Profile() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
console.log(turnstileEnabled, turnstileSiteKey, status);
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const submit = async () => {
|
const submit = async () => {
|
||||||
@ -284,6 +290,7 @@ export default function Profile() {
|
|||||||
<EmailModal
|
<EmailModal
|
||||||
open={openEmail}
|
open={openEmail}
|
||||||
turnstileToken={turnstileToken}
|
turnstileToken={turnstileToken}
|
||||||
|
turnstileEnabled={turnstileEnabled}
|
||||||
handleClose={() => {
|
handleClose={() => {
|
||||||
setOpenEmail(false);
|
setOpenEmail(false);
|
||||||
}}
|
}}
|
||||||
|
@ -46,6 +46,7 @@ const EditModal = ({ open, redemptiondId, onCancel, onOk }) => {
|
|||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
||||||
let res;
|
let res;
|
||||||
|
try {
|
||||||
if (values.is_edit) {
|
if (values.is_edit) {
|
||||||
res = await API.put(`/api/redemption/`, { ...values, id: parseInt(redemptiondId) });
|
res = await API.put(`/api/redemption/`, { ...values, id: parseInt(redemptiondId) });
|
||||||
} else {
|
} else {
|
||||||
@ -72,9 +73,13 @@ const EditModal = ({ open, redemptiondId, onCancel, onOk }) => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
setErrors({ submit: message });
|
setErrors({ submit: message });
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadRedemptiond = async () => {
|
const loadRedemptiond = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/redemption/${redemptiondId}`);
|
let res = await API.get(`/api/redemption/${redemptiondId}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -83,6 +88,9 @@ const EditModal = ({ open, redemptiondId, onCancel, onOk }) => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -30,6 +30,7 @@ export default function Redemption() {
|
|||||||
|
|
||||||
const loadRedemptions = async (startIdx) => {
|
const loadRedemptions = async (startIdx) => {
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/redemption/?p=${startIdx}`);
|
const res = await API.get(`/api/redemption/?p=${startIdx}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -43,6 +44,9 @@ export default function Redemption() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -64,6 +68,8 @@ export default function Redemption() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/redemption/search?keyword=${searchKeyword}`);
|
const res = await API.get(`/api/redemption/search?keyword=${searchKeyword}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -72,6 +78,10 @@ export default function Redemption() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -83,6 +93,8 @@ export default function Redemption() {
|
|||||||
const url = '/api/redemption/';
|
const url = '/api/redemption/';
|
||||||
let data = { id };
|
let data = { id };
|
||||||
let res;
|
let res;
|
||||||
|
|
||||||
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
res = await API.delete(url + id);
|
res = await API.delete(url + id);
|
||||||
@ -105,6 +117,9 @@ export default function Redemption() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理刷新
|
// 处理刷新
|
||||||
|
@ -36,6 +36,7 @@ const OperationSetting = () => {
|
|||||||
let [historyTimestamp, setHistoryTimestamp] = useState(now.getTime() / 1000 - 30 * 24 * 3600); // a month ago new Date().getTime() / 1000 + 3600
|
let [historyTimestamp, setHistoryTimestamp] = useState(now.getTime() / 1000 - 30 * 24 * 3600); // a month ago new Date().getTime() / 1000 + 3600
|
||||||
|
|
||||||
const getOptions = async () => {
|
const getOptions = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/option/');
|
const res = await API.get('/api/option/');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -51,6 +52,9 @@ const OperationSetting = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -62,6 +66,8 @@ const OperationSetting = () => {
|
|||||||
if (key.endsWith('Enabled')) {
|
if (key.endsWith('Enabled')) {
|
||||||
value = inputs[key] === 'true' ? 'false' : 'true';
|
value = inputs[key] === 'true' ? 'false' : 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await API.put('/api/option/', {
|
const res = await API.put('/api/option/', {
|
||||||
key,
|
key,
|
||||||
value
|
value
|
||||||
@ -72,6 +78,10 @@ const OperationSetting = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -146,6 +156,7 @@ const OperationSetting = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const deleteHistoryLogs = async () => {
|
const deleteHistoryLogs = async () => {
|
||||||
|
try {
|
||||||
const res = await API.delete(`/api/log/?target_timestamp=${Math.floor(historyTimestamp)}`);
|
const res = await API.delete(`/api/log/?target_timestamp=${Math.floor(historyTimestamp)}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -153,6 +164,9 @@ const OperationSetting = () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
showError('日志清理失败:' + message);
|
showError('日志清理失败:' + message);
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -36,6 +36,7 @@ const OtherSetting = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const getOptions = async () => {
|
const getOptions = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/option/');
|
const res = await API.get('/api/option/');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -49,6 +50,9 @@ const OtherSetting = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -58,6 +62,7 @@ const OtherSetting = () => {
|
|||||||
|
|
||||||
const updateOption = async (key, value) => {
|
const updateOption = async (key, value) => {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
|
try {
|
||||||
const res = await API.put('/api/option/', {
|
const res = await API.put('/api/option/', {
|
||||||
key,
|
key,
|
||||||
value
|
value
|
||||||
@ -70,6 +75,9 @@ const OtherSetting = () => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleInputChange = async (event) => {
|
const handleInputChange = async (event) => {
|
||||||
@ -106,6 +114,7 @@ const OtherSetting = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const checkUpdate = async () => {
|
const checkUpdate = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('https://api.github.com/repos/MartialBE/one-api/releases/latest');
|
const res = await API.get('https://api.github.com/repos/MartialBE/one-api/releases/latest');
|
||||||
const { tag_name, body } = res.data;
|
const { tag_name, body } = res.data;
|
||||||
if (tag_name === process.env.REACT_APP_VERSION) {
|
if (tag_name === process.env.REACT_APP_VERSION) {
|
||||||
@ -117,6 +126,9 @@ const OtherSetting = () => {
|
|||||||
});
|
});
|
||||||
setShowUpdateModal(true);
|
setShowUpdateModal(true);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -56,6 +56,7 @@ const SystemSetting = () => {
|
|||||||
const [showPasswordWarningModal, setShowPasswordWarningModal] = useState(false);
|
const [showPasswordWarningModal, setShowPasswordWarningModal] = useState(false);
|
||||||
|
|
||||||
const getOptions = async () => {
|
const getOptions = async () => {
|
||||||
|
try {
|
||||||
const res = await API.get('/api/option/');
|
const res = await API.get('/api/option/');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -73,6 +74,9 @@ const SystemSetting = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -95,6 +99,8 @@ const SystemSetting = () => {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await API.put('/api/option/', {
|
const res = await API.put('/api/option/', {
|
||||||
key,
|
key,
|
||||||
value
|
value
|
||||||
@ -112,6 +118,10 @@ const SystemSetting = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,6 +52,8 @@ const EditModal = ({ open, tokenId, onCancel, onOk }) => {
|
|||||||
|
|
||||||
values.remain_quota = parseInt(values.remain_quota);
|
values.remain_quota = parseInt(values.remain_quota);
|
||||||
let res;
|
let res;
|
||||||
|
|
||||||
|
try {
|
||||||
if (values.is_edit) {
|
if (values.is_edit) {
|
||||||
res = await API.put(`/api/token/`, { ...values, id: parseInt(tokenId) });
|
res = await API.put(`/api/token/`, { ...values, id: parseInt(tokenId) });
|
||||||
} else {
|
} else {
|
||||||
@ -71,9 +73,13 @@ const EditModal = ({ open, tokenId, onCancel, onOk }) => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
setErrors({ submit: message });
|
setErrors({ submit: message });
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadToken = async () => {
|
const loadToken = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/token/${tokenId}`);
|
let res = await API.get(`/api/token/${tokenId}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -82,6 +88,9 @@ const EditModal = ({ open, tokenId, onCancel, onOk }) => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -32,6 +32,7 @@ export default function Token() {
|
|||||||
|
|
||||||
const loadTokens = async (startIdx) => {
|
const loadTokens = async (startIdx) => {
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/token/?p=${startIdx}`);
|
const res = await API.get(`/api/token/?p=${startIdx}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -45,6 +46,10 @@ export default function Token() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -75,6 +80,8 @@ export default function Token() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/token/search?keyword=${searchKeyword}`);
|
const res = await API.get(`/api/token/search?keyword=${searchKeyword}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -83,6 +90,10 @@ export default function Token() {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -94,6 +105,7 @@ export default function Token() {
|
|||||||
const url = '/api/token/';
|
const url = '/api/token/';
|
||||||
let data = { id };
|
let data = { id };
|
||||||
let res;
|
let res;
|
||||||
|
try {
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case 'delete':
|
case 'delete':
|
||||||
res = await API.delete(url + id);
|
res = await API.delete(url + id);
|
||||||
@ -116,6 +128,9 @@ export default function Token() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理刷新
|
// 处理刷新
|
||||||
|
@ -16,6 +16,8 @@ const InviteCard = () => {
|
|||||||
showSuccess(`邀请链接已复制到剪切板`);
|
showSuccess(`邀请链接已复制到剪切板`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
const res = await API.get('/api/user/aff');
|
const res = await API.get('/api/user/aff');
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -26,6 +28,9 @@ const InviteCard = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -51,6 +51,7 @@ const TopupCard = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const getUserQuota = async () => {
|
const getUserQuota = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/user/self`);
|
let res = await API.get(`/api/user/self`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -58,6 +59,9 @@ const TopupCard = () => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -66,6 +66,8 @@ const EditModal = ({ open, userId, onCancel, onOk }) => {
|
|||||||
setSubmitting(true);
|
setSubmitting(true);
|
||||||
|
|
||||||
let res;
|
let res;
|
||||||
|
|
||||||
|
try {
|
||||||
if (values.is_edit) {
|
if (values.is_edit) {
|
||||||
res = await API.put(`/api/user/`, { ...values, id: parseInt(userId) });
|
res = await API.put(`/api/user/`, { ...values, id: parseInt(userId) });
|
||||||
} else {
|
} else {
|
||||||
@ -85,6 +87,9 @@ const EditModal = ({ open, userId, onCancel, onOk }) => {
|
|||||||
showError(message);
|
showError(message);
|
||||||
setErrors({ submit: message });
|
setErrors({ submit: message });
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleClickShowPassword = () => {
|
const handleClickShowPassword = () => {
|
||||||
@ -96,6 +101,7 @@ const EditModal = ({ open, userId, onCancel, onOk }) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadUser = async () => {
|
const loadUser = async () => {
|
||||||
|
try {
|
||||||
let res = await API.get(`/api/user/${userId}`);
|
let res = await API.get(`/api/user/${userId}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -104,6 +110,9 @@ const EditModal = ({ open, userId, onCancel, onOk }) => {
|
|||||||
} else {
|
} else {
|
||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const fetchGroups = async () => {
|
const fetchGroups = async () => {
|
||||||
|
@ -30,6 +30,7 @@ export default function Users() {
|
|||||||
|
|
||||||
const loadUsers = async (startIdx) => {
|
const loadUsers = async (startIdx) => {
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/user/?p=${startIdx}`);
|
const res = await API.get(`/api/user/?p=${startIdx}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -44,6 +45,10 @@ export default function Users() {
|
|||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
|
} catch (error) {
|
||||||
|
setSearching(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const onPaginationChange = (event, activePage) => {
|
const onPaginationChange = (event, activePage) => {
|
||||||
@ -64,6 +69,7 @@ export default function Users() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setSearching(true);
|
setSearching(true);
|
||||||
|
try {
|
||||||
const res = await API.get(`/api/user/search?keyword=${searchKeyword}`);
|
const res = await API.get(`/api/user/search?keyword=${searchKeyword}`);
|
||||||
const { success, message, data } = res.data;
|
const { success, message, data } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -73,6 +79,10 @@ export default function Users() {
|
|||||||
showError(message);
|
showError(message);
|
||||||
}
|
}
|
||||||
setSearching(false);
|
setSearching(false);
|
||||||
|
} catch (error) {
|
||||||
|
setSearching(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSearchKeyword = (event) => {
|
const handleSearchKeyword = (event) => {
|
||||||
@ -95,6 +105,7 @@ export default function Users() {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
res = await API.post(url, data);
|
res = await API.post(url, data);
|
||||||
const { success, message } = res.data;
|
const { success, message } = res.data;
|
||||||
if (success) {
|
if (success) {
|
||||||
@ -105,6 +116,9 @@ export default function Users() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return res.data;
|
return res.data;
|
||||||
|
} catch (error) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理刷新
|
// 处理刷新
|
||||||
|
Loading…
Reference in New Issue
Block a user