summaryrefslogtreecommitdiff
path: root/src/lib/auth/components/SwitchAccount.jsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/auth/components/SwitchAccount.jsx')
-rw-r--r--src/lib/auth/components/SwitchAccount.jsx10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/auth/components/SwitchAccount.jsx b/src/lib/auth/components/SwitchAccount.jsx
index 80bc584f..840758c9 100644
--- a/src/lib/auth/components/SwitchAccount.jsx
+++ b/src/lib/auth/components/SwitchAccount.jsx
@@ -16,7 +16,7 @@ import { isValid } from 'zod';
import Spinner from "@/core/components/elements/Spinner/LogoSpinner";
import useDevice from '@/core/hooks/useDevice';
import BottomPopup from '@/core/components/elements/Popup/BottomPopup';
-const SwitchAccount = ({ company_type }) => {
+const SwitchAccount = ({ company_type, setIsAprove, setUbahAkun }) => {
const { isDesktop, isMobile } = useDevice();
const auth = useAuth();
const [isOpen, setIsOpen] = useState(true);
@@ -152,21 +152,23 @@ const SwitchAccount = ({ company_type }) => {
try {
const isUpdated = await switchAccountApi({ data });
- if (isUpdated?.switch === 'Pending') {
+ if (isUpdated?.switch === 'pending') {
toast.success('Berhasil mengajukan ubah akun', { duration: 1500 });
if (typeof window !== 'undefined') {
localStorage.setItem('autoCheckProfile', 'true');
}
setTimeout(() => {
+ setIsAprove('pending');
+ setUbahAkun('pending');
window.location.reload();
}, 1500);
} else {
- toast.error('Gagal mengubah akun. Silakan coba lagi nanti.');
+ toast.error('Gagal mengubah akun. Silakan coba lagi nanti atau hubungi admin jika masalah tetap terjadi.');
setIsLoadingPopup(false);
}
} catch (error) {
console.error(error);
- toast.error('Terjadi kesalahan saat menghubungi server.');
+ toast.error('Terjadi kesalahan saat menghubungi server, silahkan cek internet Anda atau hubungi admin Indoteknik.');
setIsLoadingPopup(false);
}
};