Files
hipmi-mobile/app/(application)/(user)/waiting-room.tsx
bagasbanuna 858b441a8c Clearing apple rejected
QC: Inno

Fix:
- app.config.js
- app/(application)/(user)/investment/[id]/index.tsx
- app/(application)/(user)/voting/(tabs)/index.tsx
- app/(application)/(user)/waiting-room.tsx
- app/(application)/terms-agreement.tsx
- context/AuthContext.tsx
- ios/HIPMIBadungConnect.xcodeproj/project.pbxproj
- ios/HIPMIBadungConnect/Info.plist
- screens/Authentication/LoginView.tsx
- screens/Authentication/VerificationView.tsx
- screens/Home/topFeatureSection.tsx
- screens/Invesment/BoxBerandaSection.tsx
- screens/Invesment/ButtonInvestasiSection.tsx
- screens/Invesment/DetailDataPublishSection.tsx
- service/api-client/api-voting.ts
- service/api-config.ts

### No Issue
2025-12-02 17:48:24 +08:00

112 lines
3.0 KiB
TypeScript

import {
AlertDefaultSystem,
BoxButtonOnFooter,
ButtonCenteredOnly,
ButtonCustom,
InformationBox,
NewWrapper,
StackCustom,
ViewWrapper,
} from "@/components";
import { ICON_SIZE_BUTTON } from "@/constants/constans-value";
import { useAuth } from "@/hooks/use-auth";
import { apiUser } from "@/service/api-client/api-user";
import { Ionicons } from "@expo/vector-icons";
import { router } from "expo-router";
import { RefreshControl } from "react-native";
import Toast from "react-native-toast-message";
export default function WaitingRoom() {
const { token, isLoading, logout, userData } = useAuth();
async function handleCheck() {
try {
const response = await userData(token as string);
if (response.active) {
const checkProfile = await apiUser(response.id);
if (checkProfile?.data?.Profile) {
Toast.show({
type: "success",
text1: "Akun anda telah aktif kembali", // text2: "Anda berhasil login",
});
router.replace(`/(application)/(user)/home`);
} else {
Toast.show({
type: "success",
text1: "Selamat ! Akun anda telah aktif", // text2: "Anda berhasil login",
});
router.replace(`/(application)/(user)/profile/create`);
}
// router.replace(`/(application)/(user)/profile/create`);
} else {
Toast.show({
type: "error",
text1: "Akun anda belum aktif",
text2: "Silahkan hubungi admin",
});
}
} catch (error) {
console.log("Error check", error);
}
}
const logoutButton = () => {
return (
<>
<BoxButtonOnFooter>
<ButtonCustom
backgroundColor="red"
textColor="white"
iconLeft={
<Ionicons name="log-out" size={ICON_SIZE_BUTTON} color="white" />
}
onPress={() => {
AlertDefaultSystem({
title: "Keluar",
message: "Apakah anda yakin ingin keluar?",
textLeft: "Batal",
textRight: "Ya",
onPressRight: () => {
logout();
},
});
}}
>
Keluar
</ButtonCustom>
</BoxButtonOnFooter>
</>
);
};
return (
<>
<NewWrapper
footerComponent={logoutButton()}
refreshControl={
<RefreshControl refreshing={isLoading} onRefresh={handleCheck} />
}
>
<StackCustom>
<InformationBox
text="Akun Anda sedang menunggu aktivasi.
Silakan tunggu beberapa saat. Untuk memperbarui status, tarik layar ke bawah."
/>
{/* <ButtonCenteredOnly
isLoading={isLoading}
onPress={() => {
handleCheck();
}}
icon="refresh-ccw"
>
Check
</ButtonCenteredOnly> */}
</StackCustom>
</NewWrapper>
</>
);
}