Skip to content
This repository has been archived by the owner on Jan 5, 2022. It is now read-only.

Commit

Permalink
Merge pull request #261 from openlattice/develop
Browse files Browse the repository at this point in the history
Release 2021-05-20
  • Loading branch information
UnsungHero97 authored May 21, 2021
2 parents 86febf6 + 2b5e99a commit b241342
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/containers/access/src/EditAccessRequestContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import {
GET_ACCESS_REQUEST,
UPDATE_ACCESS_REQUEST,
clearAccessRequest,
getAccessRequest
clearAttachments,
getAccessRequest,
getAttachments,
} from './actions';
import { CenterWrapper } from './styled';

Expand Down Expand Up @@ -52,10 +54,12 @@ const EditAccessRequestContainer = () => {

useEffect(() => {
dispatch(getAccessRequest(accessRequestId));
dispatch(getAttachments(accessRequestId));
return () => {
dispatch(resetRequestState([UPDATE_ACCESS_REQUEST]));
dispatch(resetRequestState([GET_ACCESS_REQUEST]));
dispatch(clearAccessRequest());
dispatch(clearAttachments());
};
}, [accessRequestId, dispatch]);

Expand Down
7 changes: 7 additions & 0 deletions src/containers/access/src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ const clearAccessRequest = () => ({
type: CLEAR_ACCESS_REQUEST
});

const CLEAR_ATTACHMENTS :'CLEAR_ATTACHMENTS' = 'CLEAR_ATTACHMENTS';
const clearAttachments = () => ({
type: CLEAR_ATTACHMENTS
});

const UPDATE_ACCESS_REQUEST :'UPDATE_ACCESS_REQUEST' = 'UPDATE_ACCESS_REQUEST';
const updateAccessRequest :RequestSequence = newRequestSequence(UPDATE_ACCESS_REQUEST);

Expand All @@ -55,6 +60,7 @@ const deleteFieldAttachment :RequestSequence = newRequestSequence(DELETE_FIELD_A

export {
CLEAR_ACCESS_REQUEST,
CLEAR_ATTACHMENTS,
DELETE_ATTACHMENTS,
DELETE_FIELD_ATTACHMENT,
GET_ACCESS_REQUEST,
Expand All @@ -69,6 +75,7 @@ export {
UPLOAD_ATTACHMENTS,
UPLOAD_FIELD_ATTACHMENT,
clearAccessRequest,
clearAttachments,
deleteAttachments,
deleteFieldAttachment,
getAccessRequest,
Expand Down
5 changes: 5 additions & 0 deletions src/containers/access/src/reducers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { RS_INITIAL_STATE } from '../../../../core/redux/constants';
import { resetRequestStateReducer } from '../../../../core/redux/reducers';
import {
CLEAR_ACCESS_REQUEST,
CLEAR_ATTACHMENTS,
GET_ALL_ACCESS_REQUESTS,
GET_ATTACHMENTS,
GET_FORMS,
Expand Down Expand Up @@ -70,6 +71,10 @@ export default function reducer(state :Map<*, *> = INITIAL_STATE, action :Object
return state.set(ACCESS_REQUEST, INITIAL_STATE.get(ACCESS_REQUEST));
}

case CLEAR_ATTACHMENTS: {
return state.set(ATTACHMENTS, INITIAL_STATE.get(ATTACHMENTS));
}

case getForms.case(action.type): {
return getFormsReducer(state, action);
}
Expand Down

0 comments on commit b241342

Please sign in to comment.