File tree Expand file tree Collapse file tree 6 files changed +34
-24
lines changed
Expand file tree Collapse file tree 6 files changed +34
-24
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11/* eslint-disable max-len */
22import jwtDecode from 'jwt-decode' ;
33import Axios from 'axios' ;
4- import { logOut } from './logOut ' ;
4+ import router from '@/router ' ;
55
66export const setAccessToken = ( token ) => ( localStorage . setItem ( process . env . VUE_APP_ACCESS_TOKEN , token ) ) ;
77export const setRefreshToken = ( token ) => ( localStorage . setItem ( process . env . VUE_APP_REFRESH_TOKEN , token ) ) ;
@@ -24,7 +24,7 @@ export const renewAccessToken = async () => {
2424 const response = await Axios . post ( '/auth/refresh' , { } ) ;
2525 localStorage . setItem ( 'matchaAccessToken' , response . data . access_token ) ;
2626 } catch ( error ) {
27- await logOut ( ) ;
27+ await router . push ( '/accounts/signout' ) ;
2828 }
2929 }
3030} ;
Original file line number Diff line number Diff line change @@ -54,6 +54,9 @@ export default {
5454 this .slider .min = this .min ;
5555 this .slider .max = this .max ;
5656 this .slider .start = this .min ;
57+ if (this .slider .min === this .slider .max ) {
58+ this .slider .max += 1 ;
59+ }
5760 noUiSlider .create (this .$refs .slider , {
5861 start: [this .slider .startMin , this .slider .startMax ],
5962 step: this .slider .step ,
Original file line number Diff line number Diff line change 3030 <router-link v-if =" loggedIn" to =" /matches" v-bind:class =" {'navigation-button-logged-in': true, 'font-black': currentRoute === 'Matches'}" >Matches</router-link >
3131 <router-link v-if =" loggedIn" to =" /settings" v-bind:class =" {'navigation-button-logged-in': true, 'font-black': currentRoute === 'Settings'}" >Settings</router-link >
3232 <router-link v-if =" loggedIn" to =" /history" v-bind:class =" {'navigation-button-logged-in': true, 'font-black': currentRoute === 'History'}" >History</router-link >
33- <router-link v-if =" loggedIn" v-on:click.native = " logout() " to =" /" class =" navigation-button-logged-in" >Exit</router-link >
33+ <router-link v-if =" loggedIn" to =" /accounts/signout " class =" navigation-button-logged-in" >Exit</router-link >
3434 </div >
3535 </nav >
3636</template >
3737
3838<script >
3939/* eslint-disable indent */
40- import { logOut } from ' @/auth/logOut' ;
4140
4241export default {
4342 name: ' Navigation' ,
@@ -52,10 +51,5 @@ export default {
5251 return this .$store .getters .getLoggedInUser ;
5352 },
5453 },
55- methods: {
56- async logout () {
57- await logOut ();
58- },
59- },
6054};
6155 </script >
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import Settings from '../views/app/Settings.vue';
1515import User from '../components/app/users/User.vue' ;
1616import History from '../views/app/History.vue' ;
1717import Matches from '../views/app/Matches.vue' ;
18+ import SignOut from '../views/auth/SignOut.vue' ;
1819import store from '../store/index' ;
1920
2021Vue . use ( VueRouter ) ;
@@ -132,6 +133,11 @@ const routes = [
132133 component : Matches ,
133134 beforeEnter : notLoggedInRedirectLogin ,
134135 } ,
136+ {
137+ path : '/accounts/signout' ,
138+ component : SignOut ,
139+ beforeEnter : notLoggedInRedirectLogin ,
140+ } ,
135141] ;
136142
137143const router = new VueRouter ( {
Original file line number Diff line number Diff line change 1+ <template >
2+ <div >signing out...</div >
3+ </template >
4+
5+ <script >
6+
7+ export default {
8+ name: ' SignOut' ,
9+ async mounted () {
10+ await this .$http .post (' /auth/logout' , {
11+ access_token: localStorage .getItem (process .env .VUE_APP_ACCESS_TOKEN ),
12+ refresh_token: localStorage .getItem (process .env .VUE_APP_REFRESH_TOKEN ),
13+ });
14+ localStorage .removeItem (process .env .VUE_APP_ACCESS_TOKEN );
15+ localStorage .removeItem (process .env .VUE_APP_REFRESH_TOKEN );
16+ localStorage .removeItem (process .env .VUE_APP_VUEX_PERSISTED_STATE );
17+ localStorage .removeItem (process .env .VUE_APP_SECURE_LS_METADATA );
18+ await this .$store .dispatch (' logout' );
19+ window .location .reload ();
20+ },
21+ };
22+ </script >
You can’t perform that action at this time.
0 commit comments