All clients get api

This commit is contained in:
2025-06-11 14:45:53 +02:00
parent fd1c387cdb
commit 1d2a2420c2
3 changed files with 43 additions and 23 deletions

View File

@@ -12,10 +12,28 @@ export async function getUserById(userId) {
});
return response.data;
} catch (err) {
// console.error(
// `Nie udało się pobrać danych użytkownika o ID ${userId}.`,
// err.response.status
// );
console.error(
`Nie udało się pobrać danych użytkownika o ID ${userId}.`,
err.response.status
);
throw err;
}
}
export async function getAllUsers() {
const { token } = useAuthStore.getState();
const headers = token ? { Authorization: `Bearer ${token}` } : {};
try {
const response = await axios.get(`${API_URL}/clients/get/all`, {
headers: headers,
});
return response.data;
} catch (err) {
console.error(
`Nie udało się pobrać danych o użytkownikach`,
err.response.status
);
throw err;
}
}

View File

@@ -2,8 +2,6 @@ import axios from "axios";
import FormData from "form-data";
import { useAuthStore } from "@/store/authStore";
// const API_URL = "https://hopp.zikor.pl/api/v1";
const API_URL = "https://hopp.zikor.pl/api/v1";
export async function listNotices() {