diff --git a/vue/src/components/OrderForm.vue b/vue/src/components/OrderForm.vue index ffb45ce..779fe91 100644 --- a/vue/src/components/OrderForm.vue +++ b/vue/src/components/OrderForm.vue @@ -36,6 +36,7 @@
{{ err }}
+
{{ success }}
@@ -63,8 +64,9 @@ const toggleYes = () => { const toggleNo = () => { selected.value = selected.value === 'NO' ? null : 'NO' } -// show errors below form +// show error and success below form const err = ref(null) +const success = ref(null) // BUY or SELL? const side = ref(route.query.side || 'BUY') @@ -156,6 +158,10 @@ const submitSellForm = async () => { }) const res = await fetch(url, { method: 'POST', headers: { 'Content-type': 'application/json' }, body }) const resBody = await res.json() + if (res.status === 201) { + success.value = 'Order created' + return + } if (res.status !== 402) { err.value = `error: server responded with HTTP ${resBody.status}` return diff --git a/vue/src/index.css b/vue/src/index.css index ca90799..f6f4a29 100644 --- a/vue/src/index.css +++ b/vue/src/index.css @@ -61,6 +61,9 @@ a.selected { .red { color: #ff7386; } +.green { + color: #35df8d; +} .error { background-color: rgba(245, 57, 94, .24);