web-humas-fe/app/(admin)/settings/page.tsx

41 lines
1.3 KiB
TypeScript
Raw Normal View History

"use client";
import PasswordForm from "@/components/form/settings/password";
import ProfileForm from "@/components/form/settings/profile";
2025-01-30 11:34:29 +00:00
import { close, loading } from "@/config/swal";
2025-06-12 13:23:22 +00:00
import { getDetailMasterUsers, getProfile } from "@/services/master-user";
2025-08-29 11:39:32 +00:00
import { getCookiesDecrypt } from "@/utils/global";
2025-02-13 08:25:39 +00:00
import { Tab, Tabs } from "@heroui/react";
2025-06-12 13:23:22 +00:00
import Cookies from "js-cookie";
import { useEffect, useState } from "react";
export default function Settings() {
const [profile, setProfile] = useState<any>();
2025-08-29 11:39:32 +00:00
const uid = getCookiesDecrypt("uie");
useEffect(() => {
2025-06-12 15:02:57 +00:00
if (!profile) {
initFetch();
}
}, [profile]);
const initFetch = async () => {
2025-01-30 11:34:29 +00:00
loading();
2025-06-12 15:02:57 +00:00
// const profile = await getDetailMasterUsers(String(uid));
const profile = await getProfile();
setProfile(profile?.data?.data);
2025-01-30 11:34:29 +00:00
close();
};
return (
2025-01-30 11:34:29 +00:00
<div className="w-full lg:w-[60%] p-3">
<div className="flex flex-col bg-gray-50 shadow-md dark:bg-stone-900 text-black dark:text-white rounded-md p-5">
<Tabs aria-label="Tabs radius" radius="sm">
<Tab key="profile" title="Profile">
<ProfileForm profile={profile} doFetch={() => initFetch()} />
</Tab>
<Tab key="music" title="Password">
<PasswordForm doFetch={() => initFetch()} />
</Tab>
</Tabs>
</div>
</div>
);
}