Fixed Authorization when not reloading the page after logging in
the build failed
Details
the build failed
Details
This commit is contained in:
parent
491f564115
commit
5bf2e4ea70
|
@ -183,7 +183,7 @@ export default {
|
|||
this.$on('delete-submit', function () {
|
||||
// Prevent deleting already deleted authors
|
||||
if (obj) {
|
||||
HTTP.delete('authors/' + obj.id.content)
|
||||
HTTP.delete('authors/' + obj.id.content, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
if (response.status === 200 && response.data.message === 'success') {
|
||||
// Fire a notification
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
// Finally Send it
|
||||
// If we want to newly insert it, make a different request
|
||||
if (this.edit) {
|
||||
HTTP.post('authors/' + this.author.id, this.author)
|
||||
HTTP.post('authors/' + this.author.id, this.author, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
@ -117,7 +117,7 @@
|
|||
this.errorNotification(e)
|
||||
})
|
||||
} else { // insert a new author
|
||||
HTTP.put('authors', this.author)
|
||||
HTTP.put('authors', this.author, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ export default {
|
|||
this.$on('delete-submit', function () {
|
||||
// Prevent deleting already deleted books
|
||||
if (obj) {
|
||||
HTTP.delete('books/' + obj.id.content)
|
||||
HTTP.delete('books/' + obj.id.content, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
if (response.status === 200 && response.data.message === 'success') {
|
||||
// Fire a notification
|
||||
|
|
|
@ -288,7 +288,7 @@
|
|||
// Finally Send it
|
||||
// If we want to newly insert it, make a different request
|
||||
if (this.edit) {
|
||||
HTTP.post('books/' + this.book.id, this.book)
|
||||
HTTP.post('books/' + this.book.id, this.book, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
@ -307,7 +307,7 @@
|
|||
this.errorNotification(e)
|
||||
})
|
||||
} else { // insert a new book
|
||||
HTTP.put('books', this.book)
|
||||
HTTP.put('books', this.book, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
// Fire a notification
|
||||
|
|
|
@ -190,7 +190,7 @@ export default {
|
|||
this.$on('delete-submit', function () {
|
||||
// Prevent deleting already deleted item
|
||||
if (obj) {
|
||||
HTTP.delete('items/' + obj.id.content)
|
||||
HTTP.delete('items/' + obj.id.content, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
if (response.status === 200 && response.data.message === 'success') {
|
||||
// Fire a notification
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
// Finally Send it
|
||||
// If we want to newly insert it, make a different request
|
||||
if (this.edit) {
|
||||
HTTP.post('items/' + this.item.id, this.item)
|
||||
HTTP.post('items/' + this.item.id, this.item, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
@ -128,7 +128,7 @@
|
|||
this.errorNotification(e)
|
||||
})
|
||||
} else { // insert a new item
|
||||
HTTP.put('items', this.item)
|
||||
HTTP.put('items', this.item, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ export default {
|
|||
this.$on('delete-submit', function () {
|
||||
// Prevent again deleting already deleted publishers
|
||||
if (obj) {
|
||||
HTTP.delete('publishers/' + obj.id.content)
|
||||
HTTP.delete('publishers/' + obj.id.content, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
if (response.status === 200 && response.data.message === 'success') {
|
||||
// Fire a notification
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
// Finally Send it
|
||||
// If we want to newly insert it, make a different request
|
||||
if (this.edit) {
|
||||
HTTP.post('publishers/' + this.publisher.id, this.publisher)
|
||||
HTTP.post('publishers/' + this.publisher.id, this.publisher, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
@ -108,7 +108,7 @@
|
|||
this.errorNotification(e)
|
||||
})
|
||||
} else { // insert a new publisher
|
||||
HTTP.put('publishers', this.publisher)
|
||||
HTTP.put('publishers', this.publisher, { headers: {'Authorization': 'Bearer ' + localStorage.getItem('token')} })
|
||||
.then(response => {
|
||||
this.loading = false
|
||||
|
||||
|
|
|
@ -2,8 +2,5 @@ import axios from 'axios'
|
|||
let config = require('../../siteconfig.json')
|
||||
|
||||
export const HTTP = axios.create({
|
||||
baseURL: config.API_URL,
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + localStorage.getItem('token')
|
||||
}
|
||||
baseURL: config.API_URL
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue