blob: 7ba12de8f47c9e3bec86e1ca23e512f61875eb66 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
import { getHttpUserClient } from "@/http/user";
import { useUser } from "@/services/user";
import * as React from "react";
import OperationDialog from "../common/dialog/OperationDialog";
export interface ChangeNicknameDialogProps {
open: boolean;
close: () => void;
}
const ChangeNicknameDialog: React.FC<ChangeNicknameDialogProps> = (props) => {
const user = useUser();
if (user == null) return null;
return (
<OperationDialog
open={props.open}
title="settings.dialogChangeNickname.title"
inputScheme={[
{ type: "text", label: "settings.dialogChangeNickname.inputLabel" },
]}
onProcess={([newNickname]) => {
return getHttpUserClient().patch(user.username, {
nickname: newNickname,
});
}}
onClose={props.close}
/>
);
};
export default ChangeNicknameDialog;
|