From afb0646b321ee84846bedbbfbf818352a5440308 Mon Sep 17 00:00:00 2001
From: V S Tharunika <1vstharu279@gmail.com>
Date: Sun, 27 Dec 2020 16:00:58 +0530
Subject: [PATCH] the error will be reflected in the frontend

---
 book-racker/src/components/Register.vue | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/book-racker/src/components/Register.vue b/book-racker/src/components/Register.vue
index 3736be7b..0c8cfd02 100644
--- a/book-racker/src/components/Register.vue
+++ b/book-racker/src/components/Register.vue
@@ -6,6 +6,8 @@
     <br>
     <input type="password" name="password" v-model="password" placeholder="password"/>
     <br>
+    <div class="error" v-html ="error"/>
+    <br>
     <button @click="register">Register</button>
   </div>
 </template>
@@ -17,25 +19,34 @@ export default {
   data () {
     return {
       email:'',
-      password:''
-      
+      password:'',
+      error: null
     }
   },
  
   methods:{
       
       async register(){
-       await AuthentiacationService.register({
+        try{
+           await AuthentiacationService.register({
           email: this.email,
           password:this.password
         })
+        }catch(error) {
+          this.error = error.response.data.error
+
+        }
          
-      }
-}
+    }
+  }
 }
 
 </script>
 
 <style scoped>
 
+.error{
+  color:red;
+}
+
 </style>
-- 
GitLab