add error handling

This commit is contained in:
Thomas Amland
2020-07-31 14:55:21 +02:00
parent 66678c5dee
commit 29c695bbc6
5 changed files with 46 additions and 2 deletions
+8 -2
View File
@@ -10,7 +10,7 @@ interface State {
isLoggedIn: boolean;
username: null | string;
showMenu: boolean;
errors: any[];
error: Error | null;
playlists: any[];
}
@@ -19,10 +19,16 @@ const setupRootModule = (authService: AuthService, api: API): Module<State, any>
isLoggedIn: false,
username: null,
showMenu: false,
errors: [],
error: null,
playlists: [],
},
mutations: {
setError(state, error) {
state.error = error;
},
clearError(state) {
state.error = null;
},
setLoginSuccess(state, { username }) {
state.isLoggedIn = true;
state.username = username;