diff --git a/book-racker/src/components/Register.vue b/book-racker/src/components/Register.vue index 3736be7b8a64979cc14ec5755326a36777907f47..0c8cfd02cee84a25bdf2f41205afaa38c7385934 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>