File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
preprints/store/preprint-stepper
registries/store/handlers Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -313,7 +313,7 @@ export class PreprintStepperState {
313313 ctx . setState (
314314 patch ( {
315315 projectFiles : patch ( {
316- data : response . files ,
316+ data : response . data ,
317317 isLoading : false ,
318318 } ) ,
319319 } )
Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ export class FilesHandlers {
4747
4848 return this . filesService . getFilesWithoutFiltering ( filesLink , page ) . pipe (
4949 tap ( ( response ) => {
50- const newData = page === 1 ? response . files : [ ...( state . files . data ?? [ ] ) , ...response . files ] ;
50+ const newData = page === 1 ? response . data : [ ...( state . files . data ?? [ ] ) , ...response . data ] ;
5151
5252 ctx . patchState ( {
5353 files : {
5454 data : newData ,
5555 isLoading : false ,
5656 error : null ,
57- totalCount : response . meta ?. total ?? 0 ,
57+ totalCount : response . totalCount ,
5858 } ,
5959 } ) ;
6060 } ) ,
Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
1616 OsfFileRevision ,
1717 PatchFileMetadata ,
1818} from '@osf/features/files/models' ;
19+ import { PaginatedData } from '@osf/shared/models/paginated-data.model' ;
1920
2021import { FileKind } from '../enums/file-kind.enum' ;
2122import { AddonMapper } from '../mappers/addon.mapper' ;
@@ -85,13 +86,17 @@ export class FilesService {
8586 . pipe ( map ( ( response ) => ( { files : FilesMapper . getFileFolders ( response . data ) , meta : response . meta } ) ) ) ;
8687 }
8788
88- getFilesWithoutFiltering ( filesLink : string , page = 1 ) : Observable < { files : FileModel [ ] ; meta ?: MetaJsonApi } > {
89+ getFilesWithoutFiltering ( filesLink : string , page = 1 ) : Observable < PaginatedData < FileModel [ ] > > {
8990 const params : Record < string , string > = {
9091 page : page . toString ( ) ,
9192 } ;
92- return this . jsonApiService
93- . get < FilesResponseJsonApi > ( filesLink , params )
94- . pipe ( map ( ( response ) => ( { files : FilesMapper . getFiles ( response . data ) , meta : response . meta } ) ) ) ;
93+ return this . jsonApiService . get < FilesResponseJsonApi > ( filesLink , params ) . pipe (
94+ map ( ( response ) => ( {
95+ data : FilesMapper . getFiles ( response . data ) ,
96+ totalCount : response . meta . total ,
97+ pageSize : response . meta . per_page ,
98+ } ) )
99+ ) ;
95100 }
96101
97102 uploadFile (
You can’t perform that action at this time.
0 commit comments