From 0c80f5596340bffc7791692d56ae220969c3781d Mon Sep 17 00:00:00 2001 From: kolaente Date: Thu, 7 Dec 2017 10:45:33 +0100 Subject: [PATCH] Message now all lowercase when returned as json --- frontend/src/auth/index.js | 2 +- frontend/src/components/AuthorOverview.vue | 4 ++-- frontend/src/components/Authors.vue | 6 +++--- frontend/src/components/AuthorsAddEdit.vue | 4 ++-- frontend/src/components/BookOverview.vue | 4 ++-- frontend/src/components/Books.vue | 10 +++++----- frontend/src/components/BooksAddEdit.vue | 4 ++-- frontend/src/components/ItemOverview.vue | 4 ++-- frontend/src/components/Items.vue | 6 +++--- frontend/src/components/ItemsAddEdit.vue | 4 ++-- frontend/src/components/PublisherOverview.vue | 4 ++-- frontend/src/components/Publishers.vue | 6 +++--- frontend/src/components/PublishersAddEdit.vue | 4 ++-- models/message.go | 2 +- 14 files changed, 32 insertions(+), 32 deletions(-) diff --git a/frontend/src/auth/index.js b/frontend/src/auth/index.js index 615950d..96a2a17 100644 --- a/frontend/src/auth/index.js +++ b/frontend/src/auth/index.js @@ -35,7 +35,7 @@ export default { // Hide the loader context.loading = false if (e.response) { - context.error = e.response.data.Message + context.error = e.response.data.message if (e.response.status === 401) { context.error = context.translate('login').wrong } diff --git a/frontend/src/components/AuthorOverview.vue b/frontend/src/components/AuthorOverview.vue index fa9b416..b4a597e 100644 --- a/frontend/src/components/AuthorOverview.vue +++ b/frontend/src/components/AuthorOverview.vue @@ -106,8 +106,8 @@ // Build the notification text from error response console.log(e) let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/Authors.vue b/frontend/src/components/Authors.vue index b469f92..85fa008 100644 --- a/frontend/src/components/Authors.vue +++ b/frontend/src/components/Authors.vue @@ -135,8 +135,8 @@ export default { errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification @@ -185,7 +185,7 @@ export default { if (obj) { HTTP.delete('authors/' + obj.id.content) .then(response => { - if (response.status === 200 && response.data.Message === 'success') { + if (response.status === 200 && response.data.message === 'success') { // Fire a notification this.$notify({ type: 'success', diff --git a/frontend/src/components/AuthorsAddEdit.vue b/frontend/src/components/AuthorsAddEdit.vue index 94e5a38..ba93756 100644 --- a/frontend/src/components/AuthorsAddEdit.vue +++ b/frontend/src/components/AuthorsAddEdit.vue @@ -71,8 +71,8 @@ errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/BookOverview.vue b/frontend/src/components/BookOverview.vue index 6092fc4..d81e240 100644 --- a/frontend/src/components/BookOverview.vue +++ b/frontend/src/components/BookOverview.vue @@ -63,8 +63,8 @@ errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/Books.vue b/frontend/src/components/Books.vue index 32edbd9..2885277 100644 --- a/frontend/src/components/Books.vue +++ b/frontend/src/components/Books.vue @@ -150,8 +150,8 @@ export default { errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification @@ -211,8 +211,8 @@ export default { this.allStatus = response.data }) .catch(e => { - if (!e.response.data.Message) { - e.response.data = { Message: 'Could not get Status.' } + if (!e.response.data.message) { + e.response.data = { message: 'Could not get Status.' } } this.errorNotification(e) }) @@ -239,7 +239,7 @@ export default { if (obj) { HTTP.delete('books/' + obj.id.content) .then(response => { - if (response.status === 200 && response.data.Message === 'success') { + if (response.status === 200 && response.data.message === 'success') { // Fire a notification this.$notify({ type: 'success', diff --git a/frontend/src/components/BooksAddEdit.vue b/frontend/src/components/BooksAddEdit.vue index 76e092b..b5e4ca3 100644 --- a/frontend/src/components/BooksAddEdit.vue +++ b/frontend/src/components/BooksAddEdit.vue @@ -182,8 +182,8 @@ errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/ItemOverview.vue b/frontend/src/components/ItemOverview.vue index 4e51c0c..e6b82ae 100644 --- a/frontend/src/components/ItemOverview.vue +++ b/frontend/src/components/ItemOverview.vue @@ -112,8 +112,8 @@ this.loading = false // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/Items.vue b/frontend/src/components/Items.vue index 42e26a8..8d5a639 100644 --- a/frontend/src/components/Items.vue +++ b/frontend/src/components/Items.vue @@ -140,8 +140,8 @@ export default { errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification @@ -192,7 +192,7 @@ export default { if (obj) { HTTP.delete('items/' + obj.id.content) .then(response => { - if (response.status === 200 && response.data.Message === 'success') { + if (response.status === 200 && response.data.message === 'success') { // Fire a notification this.$notify({ type: 'success', diff --git a/frontend/src/components/ItemsAddEdit.vue b/frontend/src/components/ItemsAddEdit.vue index 6ac4e99..d3956f3 100644 --- a/frontend/src/components/ItemsAddEdit.vue +++ b/frontend/src/components/ItemsAddEdit.vue @@ -85,8 +85,8 @@ errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/PublisherOverview.vue b/frontend/src/components/PublisherOverview.vue index ee29477..c05e83a 100644 --- a/frontend/src/components/PublisherOverview.vue +++ b/frontend/src/components/PublisherOverview.vue @@ -99,8 +99,8 @@ this.loading = false // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/frontend/src/components/Publishers.vue b/frontend/src/components/Publishers.vue index d593483..54a600b 100644 --- a/frontend/src/components/Publishers.vue +++ b/frontend/src/components/Publishers.vue @@ -135,8 +135,8 @@ export default { errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification @@ -184,7 +184,7 @@ export default { if (obj) { HTTP.delete('publishers/' + obj.id.content) .then(response => { - if (response.status === 200 && response.data.Message === 'success') { + if (response.status === 200 && response.data.message === 'success') { // Fire a notification this.$notify({ type: 'success', diff --git a/frontend/src/components/PublishersAddEdit.vue b/frontend/src/components/PublishersAddEdit.vue index 4a13831..e8fc3b7 100644 --- a/frontend/src/components/PublishersAddEdit.vue +++ b/frontend/src/components/PublishersAddEdit.vue @@ -64,8 +64,8 @@ errorNotification (e) { // Build the notification text from error response let err = e.message - if (e.response.data.Message) { - err += '
' + e.response.data.Message + if (e.response.data.message) { + err += '
' + e.response.data.message } // Fire a notification diff --git a/models/message.go b/models/message.go index 9107dec..2e71a0b 100644 --- a/models/message.go +++ b/models/message.go @@ -2,5 +2,5 @@ package models // Message is a standard message type Message struct { - Message string + Message string `json:"message"` }