feat: update user details on settings account tab

This commit is contained in:
Zamitto 2025-01-15 16:26:44 -03:00
parent af4fcb8f06
commit c4378c0ffc
2 changed files with 18 additions and 5 deletions

View File

@ -33,7 +33,8 @@ export class DatanodesApi {
"User-Agent":
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36",
},
maxRedirects: 0, validateStatus: (status: number) => status === 302 || status < 400,
maxRedirects: 0,
validateStatus: (status: number) => status === 302 || status < 400,
}
);

View File

@ -1,5 +1,5 @@
import { Button, SelectField } from "@renderer/components";
import { SPACING_UNIT, vars } from "@renderer/theme.css";
import { SPACING_UNIT } from "@renderer/theme.css";
import { Controller, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
@ -36,9 +36,13 @@ export function SettingsAccount() {
handleSubmit,
} = useForm<FormValues>();
const { patchUser, userDetails } = useUserDetails();
const { unblockUser } = useUserDetails();
const {
userDetails,
patchUser,
fetchUserDetails,
updateUserDetails,
unblockUser,
} = useUserDetails();
useEffect(() => {
if (userDetails?.profileVisibility) {
@ -46,6 +50,14 @@ export function SettingsAccount() {
}
}, [userDetails, setValue]);
useEffect(() => {
fetchUserDetails().then((response) => {
if (response) {
updateUserDetails(response);
}
});
}, []);
const visibilityOptions = [
{ value: "PUBLIC", label: t("public") },
{ value: "FRIENDS", label: t("friends_only") },