feat: Aggiungi funzionalità di eliminazione per clienti e preventivi con gestione delle dipendenze
This commit is contained in:
@@ -146,7 +146,7 @@ onMounted(loadCarrello)
|
||||
|
||||
<div class="card">
|
||||
<div class="totale-row">
|
||||
<span>Totale <span class="iva-nota">IVA 22% inclusa</span></span>
|
||||
<span>Totale <span class="iva-nota">Prezzi IVA esclusa</span></span>
|
||||
<span>{{ formatEuro(carrello.totale) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -22,8 +22,17 @@ async function request(path, options = {}) {
|
||||
export const api = {
|
||||
getCarrello: (token) => request(`/carrello/${token}`),
|
||||
rimuoviItem: (token, itemId) => request(`/carrello/${token}/item/${itemId}`, { method: 'DELETE' }),
|
||||
conferma: (token, dati) =>
|
||||
request(`/carrello/${token}/conferma`, { method: 'POST', body: JSON.stringify(dati) }),
|
||||
// Se l'utente era loggato nel configuratore, passiamo il suo token al backend così
|
||||
// il preventivo viene agganciato al suo record cliente esistente invece di crearne
|
||||
// uno nuovo (è lo stesso token usato per precompilare l'anagrafica).
|
||||
conferma: (token, dati) => {
|
||||
const headers = {}
|
||||
const clienteToken = resolveClienteToken()
|
||||
if (clienteToken) {
|
||||
headers.Authorization = `Bearer ${clienteToken}`
|
||||
}
|
||||
return request(`/carrello/${token}/conferma`, { method: 'POST', body: JSON.stringify(dati), headers })
|
||||
},
|
||||
// Dati anagrafici del cliente loggato nel configuratore, per precompilare il checkout.
|
||||
me: (clienteToken) =>
|
||||
request('/auth/me', { headers: { Authorization: `Bearer ${clienteToken}` } }),
|
||||
|
||||
Reference in New Issue
Block a user