fix next uid

Signed-off-by: wozulong <>
This commit is contained in:
wozulong
2024-03-21 15:02:47 +08:00
parent 9855343aa8
commit 0907fa6994
7 changed files with 69 additions and 17 deletions

View File

@@ -18,6 +18,8 @@ const GitHubOAuth = () => {
const res = await API.get(`/api/oauth/github?code=${code}&state=${state}&aff=${aff}`);
const { success, message, data } = res.data;
if (success) {
localStorage.removeItem('aff');
if (message === 'bind') {
showSuccess('绑定成功!');
navigate('/setting');

View File

@@ -18,6 +18,8 @@ const LinuxDoOAuth = () => {
const res = await API.get(`/api/oauth/linuxdo?code=${code}&state=${state}&aff=${aff}`);
const { success, message, data } = res.data;
if (success) {
localStorage.removeItem('aff');
if (message === 'bind') {
showSuccess('绑定成功!');
navigate('/setting');

View File

@@ -69,6 +69,8 @@ const RegisterForm = () => {
);
const { success, message } = res.data;
if (success) {
localStorage.removeItem('aff');
navigate('/login');
showSuccess('注册成功!');
} else {

View File

@@ -112,19 +112,33 @@ const UsersTable = () => {
</>
}
<Popconfirm
title="确定是否要删除此用户?"
content="硬删除,此修改将不可逆"
okType={'danger'}
position={'left'}
onConfirm={() => {
manageUser(record.username, 'delete', record).then(() => {
removeRecord(record.id);
});
}}
>
<Button theme="light" type="danger" style={{ marginRight: 1 }}>删除</Button>
</Popconfirm>
{
record.DeletedAt !== null ? <Popconfirm
title="确定是否要删除此用户?"
content="硬删除,此修改将不可逆"
okType={'danger'}
position={'left'}
onConfirm={() => {
hardDeleteUser(record.id).then(() => {
removeRecord(record.id);
});
}}
>
<Button theme="light" type="danger" style={{ marginRight: 1 }}>永久删除</Button>
</Popconfirm> : <Popconfirm
title="确定是否要删除此用户?"
content="软删除,数据依然留底"
okType={'danger'}
position={'left'}
onConfirm={() => {
manageUser(record.username, 'delete', record).then(() => {
record.DeletedAt = new Date();
});
}}
>
<Button theme="light" type="danger" style={{ marginRight: 1 }}>删除</Button>
</Popconfirm>
}
</div>)
}];
@@ -216,9 +230,21 @@ const UsersTable = () => {
setUsers(newUsers);
} else {
showError(message);
throw new Error(message);
}
};
const hardDeleteUser = async (userId) => {
const res = await API.delete('/api/user/' + userId);
const { success, message } = res.data;
if (success) {
showSuccess('操作成功完成!');
} else {
showError(message);
throw new Error(message);
}
}
const renderStatus = (status) => {
switch (status) {
case 1: