diff --git a/src/components/Profile.vue b/src/components/Profile.vue index 26c4c3c..e3ee9e9 100644 --- a/src/components/Profile.vue +++ b/src/components/Profile.vue @@ -34,7 +34,6 @@ import Settings from '@/components/Settings.vue' import SeasonedButton from '@/components/ui/SeasonedButton.vue' import { getEmoji } from '@/api.js' -// import CreatedLists from './CreatedLists.vue' export default { components: { MoviesList, Settings, SeasonedButton }, diff --git a/src/components/Register.vue b/src/components/Register.vue index 32bc51b..19899f6 100644 --- a/src/components/Register.vue +++ b/src/components/Register.vue @@ -1,41 +1,18 @@ @@ -44,18 +21,16 @@ import axios from 'axios' import storage from '@/storage.js' import SeasonedButton from '@/components/ui/SeasonedButton.vue' import SeasonedInput from '@/components/ui/SeasonedInput.vue' +import SeasonedMessages from '@/components/ui/SeasonedMessages.vue' export default { - components: { SeasonedButton, SeasonedInput }, + components: { SeasonedButton, SeasonedInput, SeasonedMessages }, data(){ return{ - userLoggedIn: '', + messages: [], username: undefined, password: undefined, - passwordRepeat: undefined, - showMessage: false, - messageClass: 'message-success', - messageText: 'hello world' + passwordRepeat: undefined } }, methods: { @@ -71,10 +46,9 @@ export default { username: username, password: password }) - .then(function(resp) { + .then(resp => { let data = resp.data; if (data.success){ - this.msg(data.message, 'success'); localStorage.setItem('token', data.token); localStorage.setItem('username', username); localStorage.setItem('admin', data.admin) @@ -82,13 +56,13 @@ export default { eventHub.$emit('setUserStatus'); this.$router.push({ name: 'profile' }) } - }.bind(this)) - .catch(function(error){ - this.msg(error.response.data.error, 'warning') - }.bind(this)); + }) + .catch(error => { + this.messages.push({ type: 'error', title: 'Unexpected error', message: error.response.data.error }) + }); } else { - this.msg(verifyCredentials.reason, 'warning'); + this.messages.push({ type: 'warning', title: 'Parse error', message: verifyCredentials.reason }) } }, checkCredentials(username, password, password_re) { @@ -111,20 +85,6 @@ export default { } } }, - msg(text, status){ - if (status === 'warning') - this.messageClass = 'message-warning'; - else if (status === 'success') - this.messageClass = 'message-success'; - else - this.messageClass = 'message-info'; - this.messageText = text; - this.showMessage = true; - // setTimeout(() => this.showMessage = false, 3500); - }, - dismissMessage(){ - this.showMessage = false; - }, setValue(l, t) { this[l] = t }, diff --git a/src/components/Signin.vue b/src/components/Signin.vue index 9bcfabb..1be4afc 100644 --- a/src/components/Signin.vue +++ b/src/components/Signin.vue @@ -1,50 +1,34 @@ + + diff --git a/src/components/ui/SeasonedMessages.vue b/src/components/ui/SeasonedMessages.vue new file mode 100644 index 0000000..b68c415 --- /dev/null +++ b/src/components/ui/SeasonedMessages.vue @@ -0,0 +1,159 @@ + + + + + \ No newline at end of file