fix integration

This commit is contained in:
2025-06-05 21:40:30 +02:00
parent 3bd3b9b70d
commit 48cf5cd6c4
9 changed files with 92 additions and 33 deletions

View File

@@ -1,10 +1,15 @@
import axios from "axios";
import {useAuthStore} from "@/store/authStore";
const API_URL = "https://testowe.zikor.pl/api/v1";
export async function listCategories() {
const { token } = useAuthStore.getState();
const headers = token ? { 'Authorization': `Bearer ${token}` } : {};
try {
const response = await axios.get(`${API_URL}/vars/categories`);
const response = await axios.get(`${API_URL}/vars/categories`, { headers });
return response.data;
} catch (err) {
console.error("Nie udało się pobrać listy kategorii.", err.response.status);