Skip to content

Commit

Permalink
Attempt fix redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
LucHeart committed Sep 24, 2024
1 parent b31a26f commit 35ca637
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ import "./Slider.scss";
import "./App.scss";
import 'sweetalert2/dist/sweetalert2.min.css';
import App from '@/App';
import mitt from 'mitt';
import Footer from '@/Footer';
import router from '@/router';
import storeA from '@/store';
import mitt from 'mitt';
import BootstrapVueNext from 'bootstrap-vue-next'
import VueSweetalert2 from 'vue-sweetalert2';

Expand Down Expand Up @@ -82,6 +82,10 @@ Sentry.init({
});
}

emitter.on('logout', () => {
router.push('/account/login');
utils.setLogin("");
});

app.mount('#app');

Expand Down
4 changes: 2 additions & 2 deletions src/store/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createStore } from 'vuex';
import axios from "axios";
import router from '@/router';

const store = createStore({
state() {
Expand Down Expand Up @@ -95,7 +94,8 @@ const store = createStore({
console.log("Successfully fetched self");
return;
} else if(res.status === 401) {
router.push('/account/login');
emitter.emit('logout');
return;
} else console.log("Self status code is " + res.status + " with message " + res.data);
} catch (e) {
console.log(e);
Expand Down

0 comments on commit 35ca637

Please sign in to comment.