Revert "feat: improve asset loading (#484)"

This reverts commit f3ae225d64.
This commit is contained in:
bszabo
2024-06-26 10:02:59 -04:00
committed by GitHub
parent c84e3229f6
commit ba8141ea6a
47 changed files with 404 additions and 635 deletions

View File

@@ -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 }),
),

View File

@@ -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 }));
});
});

View File

@@ -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: [
{

View File

@@ -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 }) => (

View File

@@ -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', () => {