add dashboard, home, login, layout, api
This commit is contained in:
@@ -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 });
|
||||
Reference in New Issue
Block a user