Commit b85441ad authored by Khalid Ali's avatar Khalid Ali
Browse files

Finish commit

parent 4f9224a3
Pipeline #4406 failed with stages
in 3 minutes and 10 seconds
...@@ -152,7 +152,17 @@ export default class CreateListing extends Vue { ...@@ -152,7 +152,17 @@ export default class CreateListing extends Vue {
{value: 0, text: 'Access Code NOT Included'}, {value: 0, text: 'Access Code NOT Included'},
]; ];
mounted() { created() {
// Must be logged in
API.get("/bs/api/").catch(function (error) {
console.log(error.response);
// Redirect to backend login
if (error.response == undefined || error.response.status == 403) {
location.replace('https://localhost:9090/bs/api/login');
}
});
// Get CSRF Token
API.get("/").then(function (response) { API.get("/").then(function (response) {
const token = response.headers["x-csrf-token"]; const token = response.headers["x-csrf-token"];
if (response.headers["x-csrf-token"] != null) { if (response.headers["x-csrf-token"] != null) {
......
...@@ -57,11 +57,14 @@ import API from '../api'; ...@@ -57,11 +57,14 @@ import API from '../api';
}) })
export default class Home extends Vue { export default class Home extends Vue {
mounted() { mounted() {
// if (this.$route.query.ticket != null) { // API.get("/").then(function (response) {
// var token = JSON.stringify(this.$route.query.ticket).slice(1,-1); // const token = response.headers["x-csrf-token"];
// localStorage.setItem('token', token); // if (response.headers["x-csrf-token"] != null) {
// API.defaults.headers.common['ticket'] = token; // localStorage.setItem("csrf_token", token);
// } // }
// }).catch(function (error) {
// console.log(error.response);
// })
} }
} }
</script> </script>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment