diff --git a/app/(root)/(tabs)/index.tsx b/app/(root)/(tabs)/index.tsx index 40cb173..9ff08e0 100644 --- a/app/(root)/(tabs)/index.tsx +++ b/app/(root)/(tabs)/index.tsx @@ -12,7 +12,7 @@ export default function Index() { const {user, refetch} = useGlobalContext(); return ( - ( )} diff --git a/components/Cards.tsx b/components/Cards.tsx index 11c3053..fe15694 100644 --- a/components/Cards.tsx +++ b/components/Cards.tsx @@ -16,7 +16,7 @@ export const FeaturedCard = ({onPress} :Props) => { - 5.0 + 5 Honda - xyz diff --git a/lib/appwrite.ts b/lib/appwrite.ts index 14a3440..452f137 100644 --- a/lib/appwrite.ts +++ b/lib/appwrite.ts @@ -1,11 +1,18 @@ -import {Account, Avatars, Client, OAuthProvider} from "react-native-appwrite"; +import {Account, Avatars, Client, Databases, OAuthProvider, Query} from "react-native-appwrite"; import * as Linking from "expo-linking" import {openAuthSessionAsync} from "expo-web-browser"; +import {attribute} from "postcss-selector-parser"; +import limit from "ajv-formats/src/limit"; export const config = { platform: 'com.placebomk.mobilemk', endpoint: process.env.EXPO_PUBLIC_APPWRITE_ENDPOINT, projectId: process.env.EXPO_PUBLIC_APPWRITE_PROJECT_ID, + databaseId: process.env.EXPO_PUBLIC_APPWRITE_DATABASE_ID, + oglasuvacId: process.env.EXPO_PUBLIC_APPWRITE_OGLASUVAC_COLLECTION_ID, + galleryId: process.env.EXPO_PUBLIC_APPWRITE_GALERIES_COLLECTION_ID, + reviewId: process.env.EXPO_PUBLIC_APPWRITE_REVIEWS_COLLECTION_ID, + vehicleId: process.env.EXPO_PUBLIC_APPWRITE_VEHICLE_COLLECTION_ID, } export const client = new Client(); @@ -17,7 +24,7 @@ client export const avatar = new Avatars(client); export const account = new Account(client); - +export const databases = new Databases(client); export async function login (){ // Your code here to authenticate the user and return their JWT token. @@ -79,4 +86,29 @@ export async function logOut(): Promise { console.error("Failed to log out user:", error); return false; } +} + +export async function getData() { + try { + const result =await databases.listDocuments( + config.databaseId!, + config.vehicleId!, + [Query.orderAsc(`$createdAt`), Query.limit(5)], + + ) + console.log(result.documents) + return result.documents; + } + catch (error) { + console.error("Failed to fetch data:", error); + return []; + } +} + +export async function getVehicles({filter, query, limit}: { + filter?: string; + query?: string; + limit?: number; +}){ + } \ No newline at end of file diff --git a/notes.md b/notes.md index c937919..8c1f98b 100644 --- a/notes.md +++ b/notes.md @@ -1 +1,2 @@ splash screen not showing +database seed 2:32