|
|
@ -41,7 +41,7 @@ export interface StoreState {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function fetchTypeIdentityReducer(state: FetchType<any>, action: any) {
|
|
|
|
function fetchTypeIdentityReducer(state: FetchType<any>, action: any, extend: boolean = false) {
|
|
|
|
if (action.error) {
|
|
|
|
if (action.error) {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
value: null,
|
|
|
|
value: null,
|
|
|
@ -49,9 +49,18 @@ function fetchTypeIdentityReducer(state: FetchType<any>, action: any) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
const fetching = (action.payload === undefined) ? true : undefined;
|
|
|
|
const fetching = (action.payload === undefined) ? true : undefined;
|
|
|
|
|
|
|
|
const payload = (action.payload === undefined) ? null : action.payload;
|
|
|
|
|
|
|
|
let value = state.value;
|
|
|
|
|
|
|
|
if (extend && (value !== null)) {
|
|
|
|
|
|
|
|
if (payload !== null) {
|
|
|
|
|
|
|
|
value = value.concat(payload);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
value = payload;
|
|
|
|
|
|
|
|
}
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
fetching,
|
|
|
|
fetching,
|
|
|
|
value: (action.payload === undefined) ? null : action.payload,
|
|
|
|
value,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -118,8 +127,10 @@ const credentials = handleActions(
|
|
|
|
const entries = handleAction(
|
|
|
|
const entries = handleAction(
|
|
|
|
fetchEntries,
|
|
|
|
fetchEntries,
|
|
|
|
(state: EntriesType, action: any) => {
|
|
|
|
(state: EntriesType, action: any) => {
|
|
|
|
|
|
|
|
const prevState = state[action.meta.journal];
|
|
|
|
|
|
|
|
const extend = action.meta.prevUid != null;
|
|
|
|
return { ...state,
|
|
|
|
return { ...state,
|
|
|
|
[action.meta.journal]: fetchTypeIdentityReducer(state[action.meta.journal], action)
|
|
|
|
[action.meta.journal]: fetchTypeIdentityReducer(prevState, action, extend)
|
|
|
|
};
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{}
|
|
|
|
{}
|
|
|
|