add dashboard, home, login, layout, api

This commit is contained in:
2026-06-04 13:58:32 +02:00
parent fb2a7485bb
commit bf36210670
12 changed files with 497 additions and 231 deletions
+31
View File
@@ -0,0 +1,31 @@
// src/services/api.js
const apiCall = async (url, body = {}) => {
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
},
credentials: 'include', // Garde bien ça pour envoyer le cookie de session
body: JSON.stringify(body)
});
const data = await response.json();
if (data.error) throw new Error(data.error.message);
return data.result;
};
export const loginClient = (email, password) =>
apiCall('/api/guest/client/login', { email, password });
export const getClientProfile = () =>
apiCall('/api/client/profile/get');
// Récupère la liste des services/commandes du client
export const getClientOrders = () =>
apiCall('/api/client/order/get_list');
// Récupère les détails techniques du service rattaché à une commande
export const getOrderService = (order_id) =>
apiCall('/api/client/order/service', { id: order_id });