-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(entities): refactor document
- Loading branch information
1 parent
51254c0
commit 3a1e06d
Showing
20 changed files
with
131 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
packages/web-app/src/actions/Document/GetDocumentDetails.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import fetch from 'isomorphic-fetch'; | ||
import { getDocumentDetailsUrl } from '../../conf/apiRoutes'; | ||
import { checkAndGetStatus } from '../utils'; | ||
|
||
export const FETCH_DOCUMENT_DETAILS = 'FETCH_DOCUMENT_DETAILS'; | ||
export const FETCH_DOCUMENT_DETAILS_SUCCESS = 'FETCH_DOCUMENT_DETAILS_SUCCESS'; | ||
export const FETCH_DOCUMENT_DETAILS_FAILURE = 'FETCH_DOCUMENT_DETAILS_FAILURE'; | ||
|
||
export const fetchDocumentDetails = | ||
(documentId, requireUpdate) => (dispatch, getState) => { | ||
dispatch({ type: FETCH_DOCUMENT_DETAILS }); | ||
|
||
const requestOptions = { | ||
headers: getState().login.authorizationHeader | ||
}; | ||
|
||
const updateParam = requireUpdate ? `?requireUpdate=${requireUpdate}` : ''; | ||
return fetch( | ||
getDocumentDetailsUrl + documentId + updateParam, | ||
requestOptions | ||
) | ||
.then(checkAndGetStatus) | ||
.then(response => response.json()) | ||
.then(data => dispatch({ type: FETCH_DOCUMENT_DETAILS_SUCCESS, data })) | ||
.catch(error => | ||
dispatch({ type: FETCH_DOCUMENT_DETAILS_FAILURE, error }) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const RESET_DOCUMENT_API_ERRORS = 'RESET_DOCUMENT_API_ERRORS'; | ||
|
||
export const resetDocumentApiErrors = () => ({ | ||
type: RESET_DOCUMENT_API_ERRORS | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.