Skip to content
Snippets Groups Projects
Commit 58fea0f3 authored by henrikburmann's avatar henrikburmann
Browse files

Check for 401 error

parent c37f05ed
No related branches found
No related tags found
1 merge request!123Delete listing
Pipeline #181313 passed
......@@ -273,7 +273,7 @@ export default {
},
async deleteItem() {
await UserService.setListingToDeleted(this.chosenItem);
this.$router.go(0);
// this.$router.go(0);
},
searchWritten: function () {
//This method triggers when search input field is changed
......
// import { tokenHeader } from "@/utils/token-utils";
import { tokenHeader } from "@/utils/token-utils";
import axios from "axios";
......@@ -28,14 +27,17 @@ class UserService {
}
async setListingToDeleted(listingId) {
console.log(tokenHeader());
return await axios
.put(API_URL + "listing/" + listingId, {
headers: tokenHeader(),
headers: {Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmaX…5vIn0.4GOdg2HsKb5ubJjkO674gQRO4C0RSIsHa4X-MI2ftHg'},
})
.then((res) => {
return res.data;
})
.catch((err) => console.error(err));
.catch((err) => {
console.error(err);
})
}
async getRenterHistory() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment