Initial commit
Generated by create-expo-app 3.2.0.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
const API_URL = process.env.EXPO_PUBLIC_API_URL;
|
||||
|
||||
export interface Product {
|
||||
id: number;
|
||||
title: string;
|
||||
price: number;
|
||||
description: string;
|
||||
category: string;
|
||||
image: string;
|
||||
rating: Rating;
|
||||
}
|
||||
|
||||
export interface Rating {
|
||||
rate: number;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export const fetchProducts = async (): Promise<Product[]> => {
|
||||
const response = await fetch(`${API_URL}/products`);
|
||||
return response.json();
|
||||
};
|
||||
|
||||
export const fetchProduct = async (id: number): Promise<Product> => {
|
||||
const response = await fetch(`${API_URL}/products/${id}`);
|
||||
return response.json();
|
||||
};
|
||||
|
||||
export const getCategories = async (): Promise<string[]> => {
|
||||
const response = await fetch(`${API_URL}/products/categories`);
|
||||
return response.json();
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
export const COLORS = {
|
||||
primary: "#007AFF",
|
||||
secondary: "#FF0000",
|
||||
background: "#FFFFFF",
|
||||
text: "#000000",
|
||||
white: "#FFFFFF",
|
||||
black: "#000000",
|
||||
gray: "#666666",
|
||||
lightGray: "#999999",
|
||||
darkGray: "#333333",
|
||||
success: "#4CAF50",
|
||||
warning: "#FFC107",
|
||||
error: "#F44336",
|
||||
info: "#2196F3",
|
||||
};
|
||||
Reference in New Issue
Block a user