-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: api tweaks mostly with index.js
- Loading branch information
1 parent
e74c90f
commit 3d8d5b0
Showing
12 changed files
with
210 additions
and
110 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
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
62 changes: 62 additions & 0 deletions
62
src/editors/containers/LibraryContentEditor/data/requests.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,62 @@ | ||
import { StrictDict } from '../../../utils'; | ||
import { RequestKeys } from '../../../data/constants/requests'; | ||
import { networkRequest } from '../../../data/redux/thunkActions/requests'; | ||
|
||
/* eslint-disable import/no-cycle */ | ||
import { actions, selectors } from '../../../data/redux'; | ||
import api from './api'; | ||
|
||
/** | ||
* Tracked fetchContentStore api method. | ||
* Tracked to the `fetchContentStore` request key. | ||
* @param {[func]} onSuccess - onSuccess method ((response) => { ... }) | ||
* @param {[func]} onFailure - onFailure method ((error) => { ... }) | ||
*/ | ||
export const fetchContentStore = ({ ...rest }) => (dispatch, getState) => { | ||
dispatch(networkRequest({ | ||
requestKey: RequestKeys.fetchContentStore, | ||
promise: api.fetchContentStore({ | ||
studioEndpointUrl: selectors.app.studioEndpointUrl(getState()), | ||
}), | ||
...rest, | ||
})); | ||
}; | ||
|
||
/** | ||
* Tracked fetchLibraryProperty api method. | ||
* Tracked to the `fetchLibraryProperty` request key. | ||
* @param {[func]} onSuccess - onSuccess method ((response) => { ... }) | ||
* @param {[func]} onFailure - onFailure method ((error) => { ... }) | ||
*/ | ||
export const fetchLibraryProperty = ({ libraryId, ...rest }) => (dispatch, getState) => { | ||
dispatch(networkRequest({ | ||
requestKey: RequestKeys.fetchLibraryProperty, | ||
promise: api.fetchLibraryProperty({ | ||
studioEndpointUrl: selectors.app.studioEndpointUrl(getState()), | ||
libraryId, | ||
}), | ||
...rest, | ||
})); | ||
}; | ||
|
||
/** | ||
* Tracked fetchLibraryContent api method. | ||
* Tracked to the `fetchLibraryContent` request key. | ||
* @param {[func]} onSuccess - onSuccess method ((response) => { ... }) | ||
* @param {[func]} onFailure - onFailure method ((error) => { ... }) | ||
*/ | ||
export const fetchLibraryContent = ({ libraryId, ...rest }) => (dispatch, getState) => { | ||
dispatch(networkRequest({ | ||
requestKey: RequestKeys.fetchLibraryProperty, | ||
promise: api.fetchLibraryProperty({ | ||
studioEndpointUrl: selectors.app.studioEndpointUrl(getState()), | ||
libraryId, | ||
}), | ||
...rest, | ||
})); | ||
}; | ||
|
||
export default StrictDict({ | ||
fetchContentStore, | ||
fetchLibraryProperty, | ||
}); |
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
Oops, something went wrong.