Commit d00b5b9a authored by Oleksii Savran's avatar Oleksii Savran Committed by Viacheslav Pavlov

Logged in new user can see previous user profile info

Added clearing of other dashboard states in user logout
parent 197ad5f7
......@@ -6,6 +6,7 @@ import { CREATE_DATASET, ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UP
RECEIVE_LOCATION, REMOVE_LOCATION, DASHBOARD_REMOVE_DATASET, DASHBOARD_RECEIVE_DATASET_PAGE, RECEIVE_DATASET,
DASHBOARD_APPEND_DATASET_PAGE, DASHBOARD_RECEIVE_ACCESSIONS_PAGE, DASHBOARD_APPEND_ACCESSIONS_PAGE,
} from 'datasets/constants';
import {LOGOUT} from 'constants/login';
import Dataset from 'model/catalog/Dataset';
import { AccessionRef } from 'model/accession/AccessionRef';
......@@ -26,6 +27,9 @@ const INITIAL_STATE: {
function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, payload?: any } = { type: '', payload: {} }) {
switch (action.type) {
case LOGOUT: {
return update(state, { $set: INITIAL_STATE });
}
case CREATE_DATASET: {
const dataset: Dataset = new Dataset();
dataset.versionTag = '1.0';
......
......@@ -16,6 +16,7 @@ import {
DASHBOARD_REMOVE_DESCRIPTOR,
DASHBOARD_APPEND_DESCRIPTOR_PAGE,
} from 'descriptors/constants';
import {LOGOUT} from 'constants/login';
const INITIAL_STATE: {
......@@ -35,6 +36,10 @@ const INITIAL_STATE: {
function descriptorsDashboard(state = INITIAL_STATE, action: IReducerAction) {
switch (action.type) {
case LOGOUT: {
return update(state, { $set: INITIAL_STATE });
}
case DASHBOARD_GET_DESCRIPTOR: {
return update(state, {
loading: { $set: { uuid: action.payload } },
......
......@@ -3,6 +3,7 @@ import update from 'immutability-helper';
import { IReducerAction } from 'model/common.model';
import {DASHBOARD_RECEIVE_SUBSETS, DASHBOARD_RECEIVE_SUBSET, DASHBOARD_REMOVE_SUBSET, DASHBOARD_APPEND_SUBSETS, ADD_CREATOR_TO_SUBSET,
REMOVE_CREATOR_FROM_SUBSET, UPDATE_SUBSET_CREATOR, DASHBOARD_RECEIVE_ACCESSIONS, DASHBOARD_APPEND_ACCESSIONS} from 'subsets/constants';
import {LOGOUT} from 'constants/login';
import FilteredPage from 'model/FilteredPage';
import Subset from 'model/subset/Subset';
......@@ -30,6 +31,9 @@ const INITIAL_STATE: {
function dashboardSubsets(state = INITIAL_STATE, action: IReducerAction) {
switch (action.type) {
case LOGOUT: {
return update(state, { $set: INITIAL_STATE });
}
case DASHBOARD_RECEIVE_SUBSET: {
const { subset, error } = action.payload;
......
import {RECEIVE_USER_PROFILE} from 'constants/user';
import update from 'immutability-helper';
import {User} from 'model/user/User';
import {LOGOUT} from 'constants/login';
const INITIAL_STATE: {
userProfile: User;
......@@ -16,6 +17,11 @@ export default function user(state = INITIAL_STATE, action: { type?: string, pay
userProfile: { $set: action.payload },
});
}
case LOGOUT: {
return update(state, {
userProfile: { $set: null },
});
}
default:
return state;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment