Commit f0a6629b authored by Viacheslav Pavlov's avatar Viacheslav Pavlov
Browse files

Merge branch '203-logged-in-new-user-can-see-previous-user-profile-info' into 'master'

Logged in new user can see previous user profile info

Closes #203

See merge request genesys-pgr/genesys-ui!214
parents 197ad5f7 d00b5b9a
...@@ -6,6 +6,7 @@ import { CREATE_DATASET, ADD_CREATOR_TO_DATASET, REMOVE_CREATOR_FROM_DATASET, UP ...@@ -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, 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, DASHBOARD_APPEND_DATASET_PAGE, DASHBOARD_RECEIVE_ACCESSIONS_PAGE, DASHBOARD_APPEND_ACCESSIONS_PAGE,
} from 'datasets/constants'; } from 'datasets/constants';
import {LOGOUT} from 'constants/login';
import Dataset from 'model/catalog/Dataset'; import Dataset from 'model/catalog/Dataset';
import { AccessionRef } from 'model/accession/AccessionRef'; import { AccessionRef } from 'model/accession/AccessionRef';
...@@ -26,6 +27,9 @@ const INITIAL_STATE: { ...@@ -26,6 +27,9 @@ const INITIAL_STATE: {
function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, payload?: any } = { type: '', payload: {} }) { function datasetsDashboard(state = INITIAL_STATE, action: { type?: string, payload?: any } = { type: '', payload: {} }) {
switch (action.type) { switch (action.type) {
case LOGOUT: {
return update(state, { $set: INITIAL_STATE });
}
case CREATE_DATASET: { case CREATE_DATASET: {
const dataset: Dataset = new Dataset(); const dataset: Dataset = new Dataset();
dataset.versionTag = '1.0'; dataset.versionTag = '1.0';
......
...@@ -16,6 +16,7 @@ import { ...@@ -16,6 +16,7 @@ import {
DASHBOARD_REMOVE_DESCRIPTOR, DASHBOARD_REMOVE_DESCRIPTOR,
DASHBOARD_APPEND_DESCRIPTOR_PAGE, DASHBOARD_APPEND_DESCRIPTOR_PAGE,
} from 'descriptors/constants'; } from 'descriptors/constants';
import {LOGOUT} from 'constants/login';
const INITIAL_STATE: { const INITIAL_STATE: {
...@@ -35,6 +36,10 @@ const INITIAL_STATE: { ...@@ -35,6 +36,10 @@ const INITIAL_STATE: {
function descriptorsDashboard(state = INITIAL_STATE, action: IReducerAction) { function descriptorsDashboard(state = INITIAL_STATE, action: IReducerAction) {
switch (action.type) { switch (action.type) {
case LOGOUT: {
return update(state, { $set: INITIAL_STATE });
}
case DASHBOARD_GET_DESCRIPTOR: { case DASHBOARD_GET_DESCRIPTOR: {
return update(state, { return update(state, {
loading: { $set: { uuid: action.payload } }, loading: { $set: { uuid: action.payload } },
......
...@@ -3,6 +3,7 @@ import update from 'immutability-helper'; ...@@ -3,6 +3,7 @@ import update from 'immutability-helper';
import { IReducerAction } from 'model/common.model'; import { IReducerAction } from 'model/common.model';
import {DASHBOARD_RECEIVE_SUBSETS, DASHBOARD_RECEIVE_SUBSET, DASHBOARD_REMOVE_SUBSET, DASHBOARD_APPEND_SUBSETS, ADD_CREATOR_TO_SUBSET, 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'; 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 FilteredPage from 'model/FilteredPage';
import Subset from 'model/subset/Subset'; import Subset from 'model/subset/Subset';
...@@ -30,6 +31,9 @@ const INITIAL_STATE: { ...@@ -30,6 +31,9 @@ const INITIAL_STATE: {
function dashboardSubsets(state = INITIAL_STATE, action: IReducerAction) { function dashboardSubsets(state = INITIAL_STATE, action: IReducerAction) {
switch (action.type) { switch (action.type) {
case LOGOUT: {
return update(state, { $set: INITIAL_STATE });
}
case DASHBOARD_RECEIVE_SUBSET: { case DASHBOARD_RECEIVE_SUBSET: {
const { subset, error } = action.payload; const { subset, error } = action.payload;
......
import {RECEIVE_USER_PROFILE} from 'constants/user'; import {RECEIVE_USER_PROFILE} from 'constants/user';
import update from 'immutability-helper'; import update from 'immutability-helper';
import {User} from 'model/user/User'; import {User} from 'model/user/User';
import {LOGOUT} from 'constants/login';
const INITIAL_STATE: { const INITIAL_STATE: {
userProfile: User; userProfile: User;
...@@ -16,6 +17,11 @@ export default function user(state = INITIAL_STATE, action: { type?: string, pay ...@@ -16,6 +17,11 @@ export default function user(state = INITIAL_STATE, action: { type?: string, pay
userProfile: { $set: action.payload }, userProfile: { $set: action.payload },
}); });
} }
case LOGOUT: {
return update(state, {
userProfile: { $set: null },
});
}
default: default:
return state; 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