File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed
Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,6 @@ import jwtDecode from 'jwt-decode';
33import Axios from 'axios' ;
44import router from '@/router' ;
55
6- export const setAccessToken = ( token ) => ( localStorage . setItem ( process . env . VUE_APP_ACCESS_TOKEN , token ) ) ;
7- export const setRefreshToken = ( token ) => ( localStorage . setItem ( process . env . VUE_APP_REFRESH_TOKEN , token ) ) ;
8-
96export const getAccessToken = ( ) => ( localStorage . getItem ( process . env . VUE_APP_ACCESS_TOKEN ) ) ;
107export const getRefreshToken = ( ) => ( localStorage . getItem ( process . env . VUE_APP_REFRESH_TOKEN ) ) ;
118
Original file line number Diff line number Diff line change 4141
4242<script >
4343import jwtDecode from ' jwt-decode' ;
44- import { setAccessToken , setRefreshToken } from ' ../../auth/tokens' ;
4544
4645export default {
4746 data : () => ({
@@ -59,8 +58,8 @@ export default {
5958 try {
6059 this .clearError ();
6160 const response = await this .signInUser (this .formData );
62- setAccessToken ( response .data .return .access_token );
63- setRefreshToken ( response .data .return .refresh_token );
61+ localStorage . setItem ( process . env . VUE_APP_ACCESS_TOKEN , response .data .return .access_token );
62+ localStorage . setItem ( process . env . VUE_APP_REFRESH_TOKEN , response .data .return .refresh_token );
6463 const userId = this .getUserFromJwt (response .data .return .access_token ).id ;
6564 const user = await this .$http .get (` /users/${ userId} ` );
6665 await this .$store .dispatch (' login' , user .data );
You can’t perform that action at this time.
0 commit comments