diff --git a/assets/main.css b/assets/main.css index 445fb33..26ff67d 100644 --- a/assets/main.css +++ b/assets/main.css @@ -86,7 +86,7 @@ menu.sidebar { gap: 20px; } -div.errors { +ul.errors { color: var(--text-important); margin: 20px 0; min-height: 40px 0; diff --git a/components/login.vue b/components/login.vue index 4773bc3..6a50474 100644 --- a/components/login.vue +++ b/components/login.vue @@ -41,4 +41,4 @@ export default { return { email: "", password: "", error: ""} }, } - \ No newline at end of file + diff --git a/components/new.vue b/components/new.vue index 75b2167..dc4fc3a 100644 --- a/components/new.vue +++ b/components/new.vue @@ -173,9 +173,9 @@ selected="estimate.transaction == 1"> -
- {{e}} -
+ @@ -283,7 +283,7 @@ function setLtv(e) { loan.amount = (ltv / 100 * this.estimate.price).toFixed(2) } -// Changes loan.amount's and data() values, then syncs with data.ltv +// Changes loan.amount\'s and data() values, then syncs with data.ltv function setAmount(e) { let amount = strip(e) let loan = this.loans[this.sel] @@ -356,6 +356,18 @@ function validate() { } else if (!estimate.mIncome) { errors.push("Missing monthly income.") } + + estimate.loans.forEach(l => { + if (errors.length) return + + if (!l.amount) { + errors.push("Loan amount cannot be zero") + } else if (!l.interest) { + errors.push("Interest rate cannot be zero") + } else if (!l.term) { + errors.push("Loan term cannot be zero") + } + }) return errors } diff --git a/skouter.go b/skouter.go index 8f721b6..a5688c6 100644 --- a/skouter.go +++ b/skouter.go @@ -880,6 +880,7 @@ func api(w http.ResponseWriter, r *http.Request) { panic(err) // maybe os.Exit(1) instead } + switch { case match(p, "/api/login", &args) && r.Method == http.MethodPost: