chore: features category

This commit is contained in:
2026-03-07 15:10:18 +01:00
parent f66efee59c
commit dd31473ca1
13 changed files with 433 additions and 62 deletions
+16 -1
View File
@@ -11,7 +11,7 @@ import type {
import { getToken } from "../auth/tokenStorage";
import { extractUsernameFromToken } from "../auth/jwtUtils";
const V1 = "https://uber-stup.club/api/v1";
const V1 = "http://5.181.0.112/api/v1";
export const getJwtUsername = async (): Promise<string | null> => {
const token = await getToken();
@@ -113,6 +113,21 @@ export const logoutUser = async (): Promise<void> => {
// PRODUCTS
// ============================================
export interface Category {
id: number;
name: string;
created_at: string;
}
export const getCategories = async (): Promise<Category[]> => {
try {
const { data } = await apiClient.get(`${V1}/categories`);
return data.categories || [];
} catch {
return [];
}
};
export const getAllProducts = async () => {
try {
const { data } = await apiClient.get(`${V1}/products`);