Revert "feat: improve asset loading (#484)"
This reverts commit f3ae225d64.
This commit is contained in:
@@ -26,16 +26,9 @@ export const apiMethods = {
|
||||
fetchStudioView: ({ blockId, studioEndpointUrl }) => get(
|
||||
urls.blockStudioView({ studioEndpointUrl, blockId }),
|
||||
),
|
||||
fetchImages: ({ learningContextId, studioEndpointUrl, pageNumber }) => {
|
||||
const params = {
|
||||
asset_type: 'Images',
|
||||
page: pageNumber,
|
||||
};
|
||||
return get(
|
||||
`${urls.courseAssets({ studioEndpointUrl, learningContextId })}`,
|
||||
{ params },
|
||||
);
|
||||
},
|
||||
fetchAssets: ({ learningContextId, studioEndpointUrl }) => get(
|
||||
urls.courseAssets({ studioEndpointUrl, learningContextId }),
|
||||
),
|
||||
fetchVideos: ({ studioEndpointUrl, learningContextId }) => get(
|
||||
urls.courseVideos({ studioEndpointUrl, learningContextId }),
|
||||
),
|
||||
|
||||
@@ -126,17 +126,10 @@ describe('cms api', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('fetchImages', () => {
|
||||
describe('fetchAssets', () => {
|
||||
it('should call get with url.courseAssets', () => {
|
||||
apiMethods.fetchImages({ learningContextId, studioEndpointUrl, pageNumber: 0 });
|
||||
const params = {
|
||||
asset_type: 'Images',
|
||||
page: 0,
|
||||
};
|
||||
expect(get).toHaveBeenCalledWith(
|
||||
urls.courseAssets({ studioEndpointUrl, learningContextId }),
|
||||
{ params },
|
||||
);
|
||||
apiMethods.fetchAssets({ learningContextId, studioEndpointUrl });
|
||||
expect(get).toHaveBeenCalledWith(urls.courseAssets({ studioEndpointUrl, learningContextId }));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ export const fetchByUnitId = ({ blockId, studioEndpointUrl }) => mockPromise({
|
||||
data: { ancestors: [{ id: 'unitUrl' }] },
|
||||
});
|
||||
// eslint-disable-next-line
|
||||
export const fetchImages = ({ learningContextId, studioEndpointUrl }) => mockPromise({
|
||||
export const fetchAssets = ({ learningContextId, studioEndpointUrl }) => mockPromise({
|
||||
data: {
|
||||
assets: [
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ export const blockStudioView = ({ studioEndpointUrl, blockId }) => (
|
||||
);
|
||||
|
||||
export const courseAssets = ({ studioEndpointUrl, learningContextId }) => (
|
||||
`${studioEndpointUrl}/assets/${learningContextId}/`
|
||||
`${studioEndpointUrl}/assets/${learningContextId}/?page_size=500`
|
||||
);
|
||||
|
||||
export const thumbnailUpload = ({ studioEndpointUrl, learningContextId, videoId }) => (
|
||||
|
||||
@@ -119,7 +119,7 @@ describe('cms url methods', () => {
|
||||
describe('courseAssets', () => {
|
||||
it('returns url with studioEndpointUrl and learningContextId', () => {
|
||||
expect(courseAssets({ studioEndpointUrl, learningContextId }))
|
||||
.toEqual(`${studioEndpointUrl}/assets/${learningContextId}/`);
|
||||
.toEqual(`${studioEndpointUrl}/assets/${learningContextId}/?page_size=500`);
|
||||
});
|
||||
});
|
||||
describe('thumbnailUpload', () => {
|
||||
|
||||
Reference in New Issue
Block a user