From 3bd8d119ba88e940932eca50be406d50d73040fb Mon Sep 17 00:00:00 2001
From: Pitu <heyitspitu@gmail.com>
Date: Wed, 24 Apr 2019 08:36:28 +0000
Subject: Refactor a bit since we globally catch API exceptions

---
 src/site/pages/register.vue | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

(limited to 'src/site/pages/register.vue')

diff --git a/src/site/pages/register.vue b/src/site/pages/register.vue
index bb17298..b780ec2 100644
--- a/src/site/pages/register.vue
+++ b/src/site/pages/register.vue
@@ -5,7 +5,7 @@
 <template>
 	<section id="register"
 		class="hero is-fullheight">
-		<Navbar/>
+		<Navbar />
 		<div class="hero-body">
 			<div class="container">
 				<h1 class="title">
@@ -75,7 +75,10 @@ export default {
 		async register() {
 			if (this.isLoading) return;
 			if (this.password !== this.rePassword) {
-				this.$showToast('Passwords don\'t match', true);
+				this.$store.dispatch('alert', {
+					text: 'Passwords don\'t match',
+					error: true
+				});
 				return;
 			}
 			this.isLoading = true;
@@ -85,10 +88,11 @@ export default {
 					username: this.username,
 					password: this.password
 				});
-				this.$showToast(response.message);
+
+				this.$store.dispatch('alert', { text: response.message });
 				return this.$router.push('/login');
 			} catch (error) {
-				this.$onPromiseError(error);
+				//
 			} finally {
 				this.isLoading = false;
 			}
-- 
cgit v1.2.3

