Add:
- service/api-client/ : api route setting
- service/api-config.ts : api base url

Profil & User
Fix:
- auth logic
- crate profile

### No Issue
This commit is contained in:
2025-08-22 17:32:48 +08:00
parent 014cf387fd
commit ebcf16efba
14 changed files with 195 additions and 138 deletions

View File

@@ -3,7 +3,7 @@ import Spacing from "@/components/_ShareComponent/Spacing";
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
import { MainColor } from "@/constants/color-palet";
import { useAuth } from "@/hooks/use-auth";
import { apiClient, apiVersion } from "@/service/api";
import { apiVersion } from "@/service/api-config";
import { GStyles } from "@/styles/global-styles";
import { Redirect, router } from "expo-router";
import { useEffect, useState } from "react";
@@ -19,18 +19,11 @@ export default function LoginView() {
const { loginWithNomor, token, isAdmin, isUserActive } = useAuth();
// console.log("Token state:", token ? "AVAILABLE" : "NOT AVAILABLE");
// console.log("isAdmin state:", isAdmin);
// console.log("isUserActive state:", isUserActive);
// console.log("isAuthenticated state:", isAuthenticated);
useEffect(() => {
onLoadVersion();
}, []);
async function onLoadVersion() {
// const token = await AsyncStorage.getItem("authToken");
// console.log("Token Version:", token);
const res = await apiVersion();
setVersion(res.data);
}

View File

@@ -42,12 +42,10 @@ export default function RegisterView() {
const isValid = validasiData();
if (!isValid) return;
const response = await registerUser({
await registerUser({
nomor: nomor as string,
username: username,
});
console.log("Success register page", JSON.stringify(response, null, 2));
}
return (

View File

@@ -3,7 +3,7 @@ import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
import ButtonCustom from "@/components/Button/ButtonCustom";
import { MainColor } from "@/constants/color-palet";
import { useAuth } from "@/hooks/use-auth";
import { apiCheckCodeOtp } from "@/service/api";
import { apiCheckCodeOtp } from "@/service/api-config";
import { GStyles } from "@/styles/global-styles";
import AsyncStorage from "@react-native-async-storage/async-storage";
import { router, useLocalSearchParams } from "expo-router";
@@ -29,7 +29,6 @@ export default function VerificationView() {
async function onLoadCheckCodeOtp() {
const kodeId = await AsyncStorage.getItem("kode_otp");
const response = await apiCheckCodeOtp({ kodeId: kodeId as string });
console.log("response kode otp :", JSON.stringify(response.otp, null, 2));
setCodeOtp(response.otp);
setUserNumber(response.nomor);
}
@@ -82,7 +81,7 @@ export default function VerificationView() {
<View style={GStyles.authContainer}>
<View>
<View style={GStyles.authContainerTitle}>
<Text style={GStyles.authTitle}>Verifikasi KOde OTP</Text>
<Text style={GStyles.authTitle}>Verifikasi Kode OTP</Text>
<Spacing height={30} />
<Text style={GStyles.textLabel}>Masukan 4 digit kode otp</Text>
<Text style={GStyles.textLabel}>

View File

@@ -1,32 +0,0 @@
// import { ITabs } from "@/components/_Interface/types";
import { StackCustom } from "@/components";
import ViewWrapper from "@/components/_ShareComponent/ViewWrapper";
import { useNavigation } from "expo-router";
import React, { useEffect } from "react";
import Home_BottomFeatureSection from "./bottomFeatureSection";
import Home_ImageSection from "./imageSection";
import TabSection from "./tabSection";
import { tabsHome } from "./tabsList";
import Home_FeatureSection from "./topFeatureSection";
export default function UiHome() {
const navigation = useNavigation();
useEffect(() => {
navigation.setOptions({});
}, [navigation]);
return (
<>
<ViewWrapper footerComponent={<TabSection tabs={tabsHome} />}>
<StackCustom>
<Home_ImageSection />
<Home_FeatureSection />
<Home_BottomFeatureSection />
</StackCustom>
</ViewWrapper>
</>
);
}

View File

@@ -4,39 +4,42 @@ import { Text, TouchableOpacity, View } from "react-native";
import { stylesHome } from "./homeViewStyle";
export default function Home_FeatureSection() {
const listFeature = [
{
name: "Event",
icon: <Ionicons name="analytics" size={48} color="white" />,
onPress: () => router.push("/(application)/(user)/event/(tabs)"),
},
{
name: "Collaboration",
icon: <Ionicons name="share" size={48} color="white" />,
onPress: () => router.push("/(application)/(user)/collaboration/(tabs)"),
},
{
name: "Voting",
icon: <Ionicons name="cube" size={48} color="white" />,
onPress: () => router.push("/(application)/(user)/voting/(tabs)"),
},
{
name: "Crowdfunding",
icon: <Ionicons name="heart" size={48} color="white" />,
onPress: () => router.push("/(application)/(user)/crowdfunding"),
},
];
return (
<>
<View style={stylesHome.gridContainer}>
<TouchableOpacity
style={stylesHome.gridItem}
onPress={() => router.push("/(application)/(user)/event/(tabs)")}
>
<Ionicons name="analytics" size={48} color="white" />
<Text style={stylesHome.gridLabel}>Event</Text>
</TouchableOpacity>
<TouchableOpacity
style={stylesHome.gridItem}
onPress={() =>
router.push("/(application)/(user)/collaboration/(tabs)")
}
>
<Ionicons name="share" size={48} color="white" />
<Text style={stylesHome.gridLabel}>Collaboration</Text>
</TouchableOpacity>
<TouchableOpacity
style={stylesHome.gridItem}
onPress={() => router.push("/(application)/(user)/voting/(tabs)")}
>
<Ionicons name="cube" size={48} color="white" />
<Text style={stylesHome.gridLabel}>Voting</Text>
</TouchableOpacity>
<TouchableOpacity
style={stylesHome.gridItem}
onPress={() => router.push("/(application)/(user)/crowdfunding")}
>
<Ionicons name="heart" size={48} color="white" />
<Text style={stylesHome.gridLabel}>Crowdfunding</Text>
</TouchableOpacity>
{listFeature.map((item, index) => (
<TouchableOpacity
key={index}
style={stylesHome.gridItem}
onPress={item.onPress}
>
{item.icon}
<Text style={stylesHome.gridLabel}>{item.name}</Text>
</TouchableOpacity>
))}
</View>
</>
);