@@ -84,14 +84,32 @@ export const initialState: video & httpRequestState = {
8484 errorReason : "unknown" ,
8585} ;
8686
87+ type FetchVideoInformation = {
88+ segments : Omit < Segment , "id" > [ ] ,
89+ workflows : video [ "workflows" ] ,
90+ tracks : video [ "tracks" ] ,
91+ title : video [ "title" ] ,
92+ date : string , // Date string
93+ duration : video [ "duration" ] ,
94+ workflow_active : boolean ,
95+ locking_active : video [ "lockingActive" ] ,
96+ lock_refresh : video [ "lockRefresh" ] ,
97+ lock_uuid : video [ "lock" ] [ "uuid" ] ,
98+ lock_user : video [ "lock" ] [ "user" ] , // username
99+ waveformURIs : string [ ] ,
100+ subtitles : video [ "subtitlesFromOpencast" ] ,
101+ local : boolean ,
102+ customizedTrackSelection : boolean , // TODO: Figure out if this still exists
103+ }
104+
87105export const fetchVideoInformation = createAppAsyncThunk ( "video/fetchVideoInformation" , async ( ) => {
88106 if ( ! settings . id ) {
89107 throw new Error ( "Missing media package identifier" ) ;
90108 }
91109
92110 // const response = await client.get("https://legacy.opencast.org/admin-ng/tools/ID-dual-stream-demo/editor.json")
93111 const response = await client . get ( `${ settings . opencast . url } /editor/${ settings . id } /edit.json` ) ;
94- return JSON . parse ( response ) ;
112+ return JSON . parse ( response ) as FetchVideoInformation ;
95113} ) ;
96114
97115const updateCurrentlyAt = ( state : video , milliseconds : number ) => {
@@ -318,23 +336,7 @@ const videoSlice = createSlice({
318336 state . status = "loading" ;
319337 } ) ;
320338 builder . addCase (
321- fetchVideoInformation . fulfilled , ( state , action : PayloadAction < {
322- segments : Omit < Segment , "id" > [ ] ,
323- workflows : video [ "workflows" ] ,
324- tracks : video [ "tracks" ] ,
325- title : video [ "title" ] ,
326- date : string , // Date string
327- duration : video [ "duration" ] ,
328- workflow_active : boolean ,
329- locking_active : video [ "lockingActive" ] ,
330- lock_refresh : video [ "lockRefresh" ] ,
331- lock_uuid : video [ "lock" ] [ "uuid" ] ,
332- lock_user : video [ "lock" ] [ "user" ] , // username
333- waveformURIs : string [ ] ,
334- subtitles : video [ "subtitlesFromOpencast" ] ,
335- local : boolean ,
336- customizedTrackSelection : boolean , // TODO: Figure out if this still exists
337- } > ) => {
339+ fetchVideoInformation . fulfilled , ( state , action : PayloadAction < FetchVideoInformation > ) => {
338340 state . status = "success" ;
339341 const payload = action . payload ;
340342
0 commit comments