From c4378c0ffc44af29a78d123e56559c34b3c3dd8c Mon Sep 17 00:00:00 2001 From: Zamitto <167933696+zamitto@users.noreply.github.com> Date: Wed, 15 Jan 2025 16:26:44 -0300 Subject: [PATCH] feat: update user details on settings account tab --- src/main/services/hosters/datanodes.ts | 3 ++- .../src/pages/settings/settings-account.tsx | 20 +++++++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/main/services/hosters/datanodes.ts b/src/main/services/hosters/datanodes.ts index d77e7d51..ae144418 100644 --- a/src/main/services/hosters/datanodes.ts +++ b/src/main/services/hosters/datanodes.ts @@ -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, } ); diff --git a/src/renderer/src/pages/settings/settings-account.tsx b/src/renderer/src/pages/settings/settings-account.tsx index 16ed40e4..14fc3564 100644 --- a/src/renderer/src/pages/settings/settings-account.tsx +++ b/src/renderer/src/pages/settings/settings-account.tsx @@ -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(); - 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") },