Compare commits
3 Commits
auth/19-au
...
auth/22-au
| Author | SHA1 | Date | |
|---|---|---|---|
| df5313a243 | |||
| ebcf16efba | |||
| 014cf387fd |
@@ -10,28 +10,6 @@ export default function UserLayout() {
|
||||
return (
|
||||
<>
|
||||
<Stack screenOptions={HeaderStyles}>
|
||||
<Stack.Screen
|
||||
name="home"
|
||||
options={{
|
||||
title: "HIPMI",
|
||||
headerLeft: () => (
|
||||
<Ionicons
|
||||
name="search"
|
||||
size={20}
|
||||
color={MainColor.yellow}
|
||||
onPress={() => router.push("/user-search")}
|
||||
/>
|
||||
),
|
||||
headerRight: () => (
|
||||
<Ionicons
|
||||
name="notifications"
|
||||
size={20}
|
||||
color={MainColor.yellow}
|
||||
onPress={() => router.push("/notifications")}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
|
||||
<Stack.Screen
|
||||
name="waiting-room"
|
||||
|
||||
@@ -1,9 +1,71 @@
|
||||
import UiHome from "@/screens/Home/UiHome";
|
||||
/* eslint-disable react-hooks/exhaustive-deps */
|
||||
import { StackCustom, ViewWrapper } from "@/components";
|
||||
import { MainColor } from "@/constants/color-palet";
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import Home_BottomFeatureSection from "@/screens/Home/bottomFeatureSection";
|
||||
import Home_ImageSection from "@/screens/Home/imageSection";
|
||||
import TabSection from "@/screens/Home/tabSection";
|
||||
import { tabsHome } from "@/screens/Home/tabsList";
|
||||
import Home_FeatureSection from "@/screens/Home/topFeatureSection";
|
||||
import { apiUser } from "@/service/api-client/api-user";
|
||||
import { Ionicons } from "@expo/vector-icons";
|
||||
import { Redirect, router, Stack } from "expo-router";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function Application() {
|
||||
const { user } = useAuth();
|
||||
const [data, setData] = useState<any>({});
|
||||
|
||||
useEffect(() => {
|
||||
onLoadData();
|
||||
}, []);
|
||||
|
||||
async function onLoadData() {
|
||||
const response = await apiUser(user?.id as string);
|
||||
console.log("data user >>", JSON.stringify(response.active, null, 2));
|
||||
setData(response.data);
|
||||
}
|
||||
|
||||
if (data?.active === false) {
|
||||
return <Redirect href={`/waiting-room`} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<>
|
||||
<UiHome />
|
||||
<Stack.Screen
|
||||
options={{
|
||||
title: "HIPMI",
|
||||
headerLeft: () => (
|
||||
<Ionicons
|
||||
name="search"
|
||||
size={20}
|
||||
color={MainColor.yellow}
|
||||
onPress={() => {
|
||||
router.push("/user-search");
|
||||
}}
|
||||
/>
|
||||
),
|
||||
headerRight: () => (
|
||||
<Ionicons
|
||||
name="notifications"
|
||||
size={20}
|
||||
color={MainColor.yellow}
|
||||
onPress={() => {
|
||||
router.push("/notifications");
|
||||
}}
|
||||
/>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<ViewWrapper footerComponent={<TabSection tabs={tabsHome} />}>
|
||||
<StackCustom>
|
||||
<Home_ImageSection />
|
||||
|
||||
<Home_FeatureSection />
|
||||
|
||||
<Home_BottomFeatureSection />
|
||||
</StackCustom>
|
||||
</ViewWrapper>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,22 +11,27 @@ export default function ProfileLayout() {
|
||||
headerTitleStyle: GStyles.headerTitleStyle,
|
||||
headerTitleAlign: "center",
|
||||
headerBackButtonDisplayMode: "minimal",
|
||||
headerLeft: () => <BackButton />,
|
||||
}}
|
||||
>
|
||||
{/* <Stack.Screen name="[id]/index" options={{ headerShown: false }} /> */}
|
||||
<Stack.Screen name="[id]/edit" options={{ title: "Edit Profile" }} />
|
||||
<Stack.Screen
|
||||
name="[id]/edit"
|
||||
options={{ title: "Edit Profile", headerLeft: () => <BackButton /> }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="[id]/update-photo"
|
||||
options={{ title: "Update Foto" }}
|
||||
options={{ title: "Update Foto", headerLeft: () => <BackButton /> }}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="[id]/update-background"
|
||||
options={{ title: "Update Latar Belakang" }}
|
||||
options={{
|
||||
title: "Update Latar Belakang",
|
||||
headerLeft: () => <BackButton />,
|
||||
}}
|
||||
/>
|
||||
<Stack.Screen
|
||||
name="[id]/create"
|
||||
options={{ title: "Buat Profile" }}
|
||||
name="create"
|
||||
options={{ title: "Buat Profile", headerBackVisible: false }}
|
||||
/>
|
||||
</Stack>
|
||||
</>
|
||||
|
||||
@@ -11,27 +11,66 @@ import {
|
||||
import BoxButtonOnFooter from "@/components/Box/BoxButtonOnFooter";
|
||||
import InformationBox from "@/components/Box/InformationBox";
|
||||
import LandscapeFrameUploaded from "@/components/Image/LandscapeFrameUploaded";
|
||||
import { router, useLocalSearchParams } from "expo-router";
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import { apiCreateProfile } from "@/service/api-client/api-profile";
|
||||
import { router } from "expo-router";
|
||||
import { useState } from "react";
|
||||
import { View } from "react-native";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
||||
export default function CreateProfile() {
|
||||
const { id } = useLocalSearchParams();
|
||||
const { user } = useAuth();
|
||||
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
const [data, setData] = useState({
|
||||
id: user?.id,
|
||||
name: "",
|
||||
email: "",
|
||||
address: "",
|
||||
gender: "",
|
||||
alamat: "",
|
||||
jenisKelamin: "",
|
||||
});
|
||||
|
||||
const handlerSave = () => {
|
||||
console.log("data create profile >>", data);
|
||||
router.back();
|
||||
const handlerSave = async () => {
|
||||
if (!data.name || !data.email || !data.alamat || !data.jenisKelamin) {
|
||||
Toast.show({
|
||||
type: "info",
|
||||
text1: "Info",
|
||||
text2: "Harap isi semua data",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await apiCreateProfile(data);
|
||||
console.log("data create profile >>", JSON.stringify(response, null, 2));
|
||||
|
||||
if (response.status === 400) {
|
||||
Toast.show({
|
||||
type: "error",
|
||||
text1: "Email sudah terdaftar",
|
||||
text2: "Gunakan email lain",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
Toast.show({
|
||||
type: "success",
|
||||
text1: "Success",
|
||||
text2: "Profile berhasil dibuat",
|
||||
});
|
||||
router.push("/(application)/(user)/home");
|
||||
} catch (error) {
|
||||
console.log("error create profile >>", error);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
const footerComponent = (
|
||||
<BoxButtonOnFooter>
|
||||
<ButtonCustom
|
||||
isLoading={isLoading}
|
||||
onPress={handlerSave}
|
||||
// disabled={!data.name || !data.email || !data.address || !data.gender}
|
||||
>
|
||||
@@ -49,7 +88,7 @@ export default function CreateProfile() {
|
||||
<Spacing />
|
||||
<ButtonCenteredOnly
|
||||
icon="upload"
|
||||
onPress={() => router.navigate(`/take-picture/${id}`)}
|
||||
onPress={() => router.navigate(`/take-picture/${user?.id}`)}
|
||||
>
|
||||
Upload
|
||||
</ButtonCenteredOnly>
|
||||
@@ -63,7 +102,7 @@ export default function CreateProfile() {
|
||||
<Spacing />
|
||||
<ButtonCenteredOnly
|
||||
icon="upload"
|
||||
onPress={() => router.navigate(`/take-picture/${id}`)}
|
||||
onPress={() => router.navigate(`/take-picture/${user?.id}`)}
|
||||
>
|
||||
Upload
|
||||
</ButtonCenteredOnly>
|
||||
@@ -89,8 +128,8 @@ export default function CreateProfile() {
|
||||
required
|
||||
label="Alamat"
|
||||
placeholder="Masukkan alamat"
|
||||
value={data.address}
|
||||
onChangeText={(text) => setData({ ...data, address: text })}
|
||||
value={data.alamat}
|
||||
onChangeText={(text) => setData({ ...data, alamat: text })}
|
||||
/>
|
||||
<SelectCustom
|
||||
label="Jenis Kelamin"
|
||||
@@ -99,9 +138,11 @@ export default function CreateProfile() {
|
||||
{ label: "Laki-laki", value: "laki-laki" },
|
||||
{ label: "Perempuan", value: "perempuan" },
|
||||
]}
|
||||
value={data.gender}
|
||||
value={data.jenisKelamin}
|
||||
required
|
||||
onChange={(value) => setData({ ...(data as any), gender: value })}
|
||||
onChange={(value) =>
|
||||
setData({ ...(data as any), jenisKelamin: value })
|
||||
}
|
||||
/>
|
||||
<Spacing />
|
||||
</StackCustom>
|
||||
@@ -14,18 +14,17 @@ import { router } from "expo-router";
|
||||
import Toast from "react-native-toast-message";
|
||||
|
||||
export default function WaitingRoom() {
|
||||
const { token, userData, isLoading, logout } = useAuth();
|
||||
const { token, isLoading, logout, userData } = useAuth();
|
||||
|
||||
async function handleCheck() {
|
||||
try {
|
||||
const response = await userData(token as string);
|
||||
console.log("response check", JSON.stringify(response, null, 2));
|
||||
if (response.active) {
|
||||
Toast.show({
|
||||
type: "success",
|
||||
text1: "Akun anda telah aktif", // text2: "Anda berhasil login",
|
||||
});
|
||||
router.replace("/(application)/(user)/home");
|
||||
router.replace(`/(application)/(user)/profile/create`);
|
||||
} else {
|
||||
Toast.show({
|
||||
type: "error",
|
||||
@@ -57,7 +56,7 @@ export default function WaitingRoom() {
|
||||
onPressRight: () => {
|
||||
logout();
|
||||
},
|
||||
})
|
||||
});
|
||||
}}
|
||||
>
|
||||
Keluar
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import {
|
||||
apiClient,
|
||||
apiConfig,
|
||||
apiLogin,
|
||||
apiRegister,
|
||||
apiValidationCode,
|
||||
} from "@/service/api";
|
||||
} from "@/service/api-config";
|
||||
import { IUser } from "@/types/User";
|
||||
import AsyncStorage from "@react-native-async-storage/async-storage";
|
||||
import { router } from "expo-router";
|
||||
@@ -72,7 +72,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const response = await apiLogin({ nomor: nomor });
|
||||
console.log("Success login api", JSON.stringify(response, null, 2));
|
||||
await AsyncStorage.setItem("kode_otp", response.kodeId);
|
||||
} catch (error: any) {
|
||||
throw new Error(error.response?.data?.message || "Gagal kirim OTP");
|
||||
@@ -92,7 +91,7 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
setToken(token);
|
||||
await AsyncStorage.setItem("authToken", token);
|
||||
|
||||
const responseUser = await apiClient.get(
|
||||
const responseUser = await apiConfig.get(
|
||||
`/mobile/user?token=${token}`,
|
||||
{
|
||||
headers: {
|
||||
@@ -101,7 +100,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
}
|
||||
);
|
||||
const dataUser = responseUser.data.data;
|
||||
console.log("res validasi user :", JSON.stringify(dataUser, null, 2));
|
||||
|
||||
setUser(dataUser);
|
||||
await AsyncStorage.setItem("userData", JSON.stringify(dataUser));
|
||||
@@ -137,14 +135,13 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const userData = async (token: string) => {
|
||||
try {
|
||||
setIsLoading(true);
|
||||
const response = await apiClient.get(`/mobile/user?token=${token}`, {
|
||||
const response = await apiConfig.get(`/mobile/user?token=${token}`, {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
});
|
||||
|
||||
const dataUser = response.data.data;
|
||||
console.log("res validasi user :", JSON.stringify(dataUser, null, 2));
|
||||
|
||||
setUser(dataUser);
|
||||
await AsyncStorage.setItem("userData", JSON.stringify(dataUser));
|
||||
@@ -166,7 +163,6 @@ export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const response = await apiRegister({ data: userData });
|
||||
console.log("Success register api", JSON.stringify(response, null, 2));
|
||||
|
||||
const { token } = response;
|
||||
if (!response.success) {
|
||||
|
||||
@@ -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,23 +19,13 @@ 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);
|
||||
|
||||
const seasonKey = await apiClient.get("/mobile/season-key");
|
||||
console.log("seasonKey", seasonKey.data);
|
||||
}
|
||||
|
||||
function handleInputValue(phoneNumber: string) {
|
||||
|
||||
@@ -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 (
|
||||
|
||||
@@ -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}>
|
||||
|
||||
@@ -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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -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>
|
||||
</>
|
||||
);
|
||||
|
||||
8
service/api-client/api-profile.ts
Normal file
8
service/api-client/api-profile.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { apiConfig } from "../api-config";
|
||||
|
||||
export async function apiCreateProfile(data: any) {
|
||||
const response = await apiConfig.post(`/mobile/profile`, {
|
||||
data: data,
|
||||
});
|
||||
return response;
|
||||
}
|
||||
7
service/api-client/api-user.ts
Normal file
7
service/api-client/api-user.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { apiConfig } from "../api-config";
|
||||
|
||||
|
||||
export async function apiUser(id: string) {
|
||||
const response = await apiConfig.get(`/user/${id}`);
|
||||
return response.data;
|
||||
}
|
||||
@@ -3,20 +3,12 @@ import axios, { AxiosInstance } from "axios";
|
||||
import Constants from "expo-constants";
|
||||
const API_BASE_URL = Constants.expoConfig?.extra?.API_BASE_URL;
|
||||
|
||||
export const apiClient: AxiosInstance = axios.create({
|
||||
export const apiConfig: AxiosInstance = axios.create({
|
||||
baseURL: API_BASE_URL,
|
||||
});
|
||||
|
||||
// Endpoint yang TIDAK butuh token
|
||||
// const PUBLIC_ROUTES = [
|
||||
// // "/version",
|
||||
// "/auth/send-otp",
|
||||
// "/auth/verify-otp",
|
||||
// "/auth/register",
|
||||
// "/auth/logout", // opsional, tergantung kebutuhan
|
||||
// ];
|
||||
|
||||
apiClient.interceptors.request.use(
|
||||
apiConfig.interceptors.request.use(
|
||||
async (config) => {
|
||||
const token = await AsyncStorage.getItem("authToken");
|
||||
if (token) {
|
||||
@@ -35,25 +27,25 @@ apiClient.interceptors.request.use(
|
||||
|
||||
export async function apiVersion() {
|
||||
// console.log("API_BASE_URL", API_BASE_URL);
|
||||
const response = await apiClient.get("/version");
|
||||
const response = await apiConfig.get("/version");
|
||||
// console.log("Response version", JSON.stringify(response.data, null, 2));
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function apiLogin({ nomor }: { nomor: string }) {
|
||||
const response = await apiClient.post("/auth/login", {
|
||||
const response = await apiConfig.post("/auth/login", {
|
||||
nomor: nomor,
|
||||
});
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function apiCheckCodeOtp({ kodeId }: { kodeId: string }) {
|
||||
const response = await apiClient.get(`/auth/check/${kodeId}`);
|
||||
const response = await apiConfig.get(`/auth/check/${kodeId}`);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export async function apiValidationCode({ nomor }: { nomor: string }) {
|
||||
const response = await apiClient.post(`/auth/validasi`, {
|
||||
const response = await apiConfig.post(`/auth/validasi`, {
|
||||
nomor: nomor,
|
||||
});
|
||||
return response.data;
|
||||
@@ -64,7 +56,7 @@ export async function apiRegister({
|
||||
}: {
|
||||
data: { nomor: string; username: string };
|
||||
}) {
|
||||
const response = await apiClient.post(`/auth/register`, {
|
||||
const response = await apiConfig.post(`/auth/register`, {
|
||||
data: data,
|
||||
});
|
||||
return response.data;
|
||||
Reference in New Issue
Block a user