PHP Classes

File: frontend/js/componentes/models/salesModel.js

Recommend this page to a friend!
  Classes of Rodrigo Faustino   Livraria   frontend/js/componentes/models/salesModel.js   Download  
File: frontend/js/componentes/models/salesModel.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Livraria
Manage a bookstore using micro-services
Author: By
Last change:
Date: 3 months ago
Size: 767 bytes
 

Contents

Class file image Download
import config from '../utils/config.js'; export async function fetchSales(page = 1, startDate = '', endDate = '') { try { const response = await fetch(`${config.baseURL}/admin/sales?page=${page}&start_date=${startDate}&end_date=${endDate}`, { method: 'GET', headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem('token') } }); if (!response.ok) { const errorData = await response.json(); throw new Error(errorData.message || 'Erro desconhecido'); } return await response.json(); } catch (error) { console.error('Error fetching sales:', error); throw error; } }