Files
ArtisanConnectFrontend/ArtisanConnect/api/client.jsx
Patryk 1cc0f601fb fixes
2025-06-09 23:57:18 +02:00

22 lines
598 B
JavaScript

import axios from "axios";
import { useAuthStore } from "@/store/authStore";
const API_URL = "https://hopp.zikor.pl/api/v1";
export async function getUserById(userId) {
const { token } = useAuthStore.getState();
const headers = token ? { Authorization: `Bearer ${token}` } : {};
try {
const response = await axios.get(`${API_URL}/clients/get/${userId}`, {
headers: headers,
});
return response.data;
} catch (err) {
// console.error(
// `Nie udało się pobrać danych użytkownika o ID ${userId}.`,
// err.response.status
// );
throw err;
}
}