Password change is working

This commit is contained in:
2019-05-08 16:28:41 +10:00
parent fa615fba17
commit 6c15bbc4a3
6 changed files with 234 additions and 7 deletions
+11 -2
View File
@@ -1,4 +1,4 @@
import { LOGIN, LOGOUT } from "../actions/accounts.js";
import { LOGIN, LOGOUT, SESSIONCHANGE } from "../actions/accounts.js";
const initialStore = {
id: 0,
@@ -9,7 +9,7 @@ const initialStore = {
export function accountReducer(store = initialStore, action) {
switch(action.type) {
case LOGIN:
case LOGIN: {
let newStore = JSON.parse(JSON.stringify(initialStore));
newStore.id = action.id;
@@ -18,10 +18,19 @@ export function accountReducer(store = initialStore, action) {
newStore.token = action.token;
return newStore;
}
case LOGOUT:
return initialStore;
case SESSIONCHANGE: {
let newStore = JSON.parse(JSON.stringify(store));
newStore.token = action.token;
return newStore;
}
default:
return store;
}