diff --git a/components/estimates.vue b/components/estimates.vue index 72d830b..d1de280 100644 --- a/components/estimates.vue +++ b/components/estimates.vue @@ -54,7 +54,7 @@ ${{(estimate.price / 100).toLocaleString()}} - + @@ -142,26 +142,6 @@ function getEstimates() { }) } -function summarize() { - fetch(`/api/estimate/summarize`, - {method: 'POST', - headers: { - "Accept": "application/json", - "Authorization": `Bearer ${props.token}`, - }, - body: JSON.stringify(estimate.value), - }).then(response => { - if (response.ok) { return response.json() } else { - response.text().then(t => console.log(t)) - } - }).then(result => { - console.log(result) - if (!result || !result.length) return // Exit if token is invalid or no fees are saved - console.log('done', result) - }) - -} - function download(estimate) { fetch(`/api/pdf`, {method: 'POST', diff --git a/components/new.vue b/components/new.vue deleted file mode 100644 index 75b2167..0000000 --- a/components/new.vue +++ /dev/null @@ -1,386 +0,0 @@ - - - diff --git a/components/new/new.vue b/components/new/new.vue index 95f3ac3..5b0273c 100644 --- a/components/new/new.vue +++ b/components/new/new.vue @@ -60,7 +60,8 @@ class="bi bi-plus" viewBox="0 0 16 16"> + :estimate="estimate" + @update="(e) => estimate = e" /> @@ -99,7 +100,7 @@ const loans = [ ] // Default estimate fields -const estimate = { +let estimate = { property: "", transaction: "", occupancy: "", diff --git a/components/new/summary.vue b/components/new/summary.vue index 877750d..70a28d3 100644 --- a/components/new/summary.vue +++ b/components/new/summary.vue @@ -1,9 +1,9 @@ diff --git a/skouter.go b/skouter.go index c49e584..a5be0e0 100644 --- a/skouter.go +++ b/skouter.go @@ -366,9 +366,9 @@ func summarize(w http.ResponseWriter, db *sql.DB, r *http.Request) { var estimate Estimate err := json.NewDecoder(r.Body).Decode(&estimate) if err != nil { http.Error(w, "Invalid estimate.", 422); return } - results := estimate.makeResults() + estimate.makeResults() - json.NewEncoder(w).Encode(results) + json.NewEncoder(w).Encode(estimate) } func getLoanType( db *sql.DB, id int) (LoanType, error) {