diff options
Diffstat (limited to 'web')
| -rw-r--r-- | web/src/app/quotes/page.js | 100 |
1 files changed, 48 insertions, 52 deletions
diff --git a/web/src/app/quotes/page.js b/web/src/app/quotes/page.js index 27ae439..0dde1ec 100644 --- a/web/src/app/quotes/page.js +++ b/web/src/app/quotes/page.js @@ -86,64 +86,60 @@ export default function Quotes() { }; const handleApproveQuote = async (id) => { - if (window.confirm('Are you sure you want to approve this quote?')) { - try { - const response = await fetchWithAuth('/api/quotes/approve', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ id }) - }); - - if (!response.ok) { - throw new Error('Failed to approve quote'); - } - - setMessage({ - type: 'success', - text: 'Quote approved successfully' - }); - - // Refresh quotes - fetchPendingQuotes(); - } catch (err) { - setMessage({ - type: 'error', - text: err.message - }); + try { + const response = await fetchWithAuth('/api/quotes/approve', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ id }) + }); + + if (!response.ok) { + throw new Error('Failed to approve quote'); } + + setMessage({ + type: 'success', + text: 'Quote approved successfully' + }); + + // Refresh quotes + fetchPendingQuotes(); + } catch (err) { + setMessage({ + type: 'error', + text: err.message + }); } }; const handleRejectQuote = async (id) => { - if (window.confirm('Are you sure you want to reject this quote?')) { - try { - const response = await fetchWithAuth('/api/quotes/reject', { - method: 'POST', - headers: { - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ id }) - }); - - if (!response.ok) { - throw new Error('Failed to reject quote'); - } - - setMessage({ - type: 'success', - text: 'Quote rejected successfully' - }); - - // Refresh quotes - fetchPendingQuotes(); - } catch (err) { - setMessage({ - type: 'error', - text: err.message - }); + try { + const response = await fetchWithAuth('/api/quotes/reject', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ id }) + }); + + if (!response.ok) { + throw new Error('Failed to reject quote'); } + + setMessage({ + type: 'success', + text: 'Quote rejected successfully' + }); + + // Refresh quotes + fetchPendingQuotes(); + } catch (err) { + setMessage({ + type: 'error', + text: err.message + }); } }; |
