-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
99 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
import {IUser} from './user'; | ||
export interface IState { | ||
export interface IAuthState { | ||
token: string; | ||
user: IUser; | ||
} | ||
|
||
export interface IAuthModule { | ||
namespaced: boolean; | ||
state: IAuthState; | ||
mutations: any; | ||
actions: any; | ||
getters: any; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import {IAuthState} from '@/interfaces/state'; | ||
import {IUser} from '@/interfaces/user'; | ||
|
||
export default { | ||
user: (state: IAuthState): IUser => state.user, | ||
token: (state: IAuthState): string => state.token | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import mutations from './mutations'; | ||
import actions from './actions'; | ||
import getters from './getters'; | ||
import {IAuthModule} from '@/interfaces/state'; | ||
|
||
const authModule: IAuthModule = { | ||
namespaced: true, | ||
state: { | ||
token: localStorage.getItem('gatekeeper_token'), | ||
user: null | ||
}, | ||
mutations, | ||
actions, | ||
getters | ||
}; | ||
|
||
export default authModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {IAuthState} from '@/interfaces/state'; | ||
import {IUser} from '@/interfaces/user'; | ||
|
||
export default { | ||
setToken: (state: IAuthState, payload: string): void => { | ||
state.token = payload; | ||
}, | ||
setUser: (state: IAuthState, payload: IUser): void => { | ||
state.user = payload; | ||
} | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,10 @@ | ||
import {createStore} from 'vuex'; | ||
import mutations from './mutations'; | ||
import actions from './actions'; | ||
import getters from './getters'; | ||
import authModule from './authModule'; | ||
import uiModule from './uiModule'; | ||
|
||
export default createStore({ | ||
state: { | ||
token: localStorage.getItem('gatekeeper_token'), | ||
user: null | ||
}, | ||
mutations, | ||
actions, | ||
getters, | ||
modules: {} | ||
modules: { | ||
auth: authModule, | ||
ui: uiModule | ||
} | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
toggleSidebarMenu: (context: any): any => { | ||
context.commit('toggleSidebarMenu'); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export default { | ||
isSidebarMenuCollapsed: (state: any): boolean => | ||
state.isSidebarMenuCollapsed | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import mutations from './mutations'; | ||
import actions from './actions'; | ||
import getters from './getters'; | ||
|
||
const uiModule = { | ||
namespaced: true, | ||
state: { | ||
isSidebarMenuCollapsed: false | ||
}, | ||
mutations, | ||
actions, | ||
getters | ||
}; | ||
|
||
export default uiModule; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export default { | ||
toggleSidebarMenu: (state: any): void => { | ||
state.isSidebarMenuCollapsed = !state.isSidebarMenuCollapsed; | ||
} | ||
}; |