upd: profile dan pencarian
No Issues
This commit is contained in:
@@ -8,7 +8,7 @@ import { useAuthSession } from "@/providers/AuthProvider";
|
||||
import { AntDesign, MaterialIcons } from "@expo/vector-icons";
|
||||
import { router, Stack } from "expo-router";
|
||||
import { useState } from "react";
|
||||
import { FlatList, Image, SafeAreaView, Text, View } from "react-native";
|
||||
import { FlatList, Image, SafeAreaView, Text, ToastAndroid, View } from "react-native";
|
||||
|
||||
type PropsUser = {
|
||||
id: string
|
||||
@@ -43,9 +43,13 @@ export default function Search() {
|
||||
if (cari.length > 3) {
|
||||
const user = await decryptToken(String(token?.current))
|
||||
const hasil = await apiGetSearch({ text: cari, user: user })
|
||||
setDataUser(hasil.user)
|
||||
setDataDivisi(hasil.division)
|
||||
setDataProject(hasil.project)
|
||||
if (hasil.success) {
|
||||
setDataUser(hasil.data.user)
|
||||
setDataDivisi(hasil.data.division)
|
||||
setDataProject(hasil.data.project)
|
||||
} else {
|
||||
return ToastAndroid.show(hasil.message, ToastAndroid.SHORT)
|
||||
}
|
||||
} else {
|
||||
setDataUser([])
|
||||
setDataDivisi([])
|
||||
@@ -53,6 +57,7 @@ export default function Search() {
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
return ToastAndroid.show('Gagal melakukan pencarian', ToastAndroid.SHORT)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user