refactor: remove unused admin user update function and update related components to use new API
This commit is contained in:
@@ -5,7 +5,7 @@ import { useTranslation } from "react-i18next";
|
||||
import { toast } from "sonner";
|
||||
import { Loader2 } from "lucide-react";
|
||||
|
||||
import { putAdminMe } from "@/api/admin-auth";
|
||||
import { putAdminUser } from "@/api/admin-users";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Input } from "@/components/ui/input";
|
||||
@@ -35,9 +35,13 @@ export function AccountSettingsConsole() {
|
||||
toast.error(t("validation.required", { field: t("fields.nickname") }));
|
||||
return;
|
||||
}
|
||||
if (!adminProfile) {
|
||||
toast.error(t("actions.updateFailed"));
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
await putAdminMe({ nickname: nickname.trim() });
|
||||
await putAdminUser(adminProfile.id, { nickname: nickname.trim() });
|
||||
toast.success(t("actions.updateSuccess"));
|
||||
void refreshAdminProfile();
|
||||
} catch (err) {
|
||||
@@ -56,9 +60,13 @@ export function AccountSettingsConsole() {
|
||||
toast.error(t("validation.passwordMismatch"));
|
||||
return;
|
||||
}
|
||||
if (!adminProfile) {
|
||||
toast.error(t("actions.updateFailed"));
|
||||
return;
|
||||
}
|
||||
setLoading(true);
|
||||
try {
|
||||
await putAdminMe({ password });
|
||||
await putAdminUser(adminProfile.id, { password });
|
||||
toast.success(t("actions.updateSuccess"));
|
||||
setPassword("");
|
||||
setConfirmPassword("");
|
||||
|
||||
Reference in New Issue
Block a user