feat: berry theme update & bug fix (#1471)

* feat: load channel models from server

* chore: support AWS Claude/Cloudflare/Coze

* fix: Popup message when copying fails

* chore: Optimize tips
This commit is contained in:
Buer
2024-05-28 01:22:40 +08:00
committed by GitHub
parent 0acee9a065
commit 07b2fd58d6
12 changed files with 448 additions and 469 deletions

View File

@@ -1,22 +1,22 @@
import { useState, useEffect } from "react";
import { useSearchParams } from "react-router-dom";
import { useState, useEffect } from 'react';
import { useSearchParams } from 'react-router-dom';
// material-ui
import { Button, Stack, Typography, Alert } from "@mui/material";
import { Button, Stack, Typography, Alert } from '@mui/material';
// assets
import { showError, showInfo } from "utils/common";
import { API } from "utils/api";
import { showError, copy } from 'utils/common';
import { API } from 'utils/api';
// ===========================|| FIREBASE - REGISTER ||=========================== //
const ResetPasswordForm = () => {
const [searchParams] = useSearchParams();
const [inputs, setInputs] = useState({
email: "",
token: "",
email: '',
token: ''
});
const [newPassword, setNewPassword] = useState("");
const [newPassword, setNewPassword] = useState('');
const submit = async () => {
const res = await API.post(`/api/user/reset`, inputs);
@@ -24,31 +24,25 @@ const ResetPasswordForm = () => {
if (success) {
let password = res.data.data;
setNewPassword(password);
navigator.clipboard.writeText(password);
showInfo(`新密码已复制到剪贴板:${password}`);
copy(password, '新密码');
} else {
showError(message);
}
};
useEffect(() => {
let email = searchParams.get("email");
let token = searchParams.get("token");
let email = searchParams.get('email');
let token = searchParams.get('token');
setInputs({
token,
email,
email
});
}, []);
return (
<Stack
spacing={3}
padding={"24px"}
justifyContent={"center"}
alignItems={"center"}
>
<Stack spacing={3} padding={'24px'} justifyContent={'center'} alignItems={'center'}>
{!inputs.email || !inputs.token ? (
<Typography variant="h3" sx={{ textDecoration: "none" }}>
<Typography variant="h3" sx={{ textDecoration: 'none' }}>
无效的链接
</Typography>
) : newPassword ? (
@@ -57,14 +51,7 @@ const ResetPasswordForm = () => {
请登录后及时修改密码
</Alert>
) : (
<Button
fullWidth
onClick={submit}
size="large"
type="submit"
variant="contained"
color="primary"
>
<Button fullWidth onClick={submit} size="large" type="submit" variant="contained" color="primary">
点击重置密码
</Button>
)}