File tree Expand file tree Collapse file tree 4 files changed +33
-25
lines changed
Expand file tree Collapse file tree 4 files changed +33
-25
lines changed Original file line number Diff line number Diff line change @@ -68,17 +68,16 @@ export function DeleteVideoDialog() {
6868
6969 setDeleteVideoData ( undefined ) ;
7070
71- const result = await deleteVideoServerFn ( {
72- data : { videoId : deleteVideoData . id } ,
73- } ) ;
74-
75- if ( ! result . success ) {
76- reset ( result . message ) ;
77- } else {
78- toast . success ( "Video deleted" , {
79- description : result . message ,
80- } ) ;
81- }
71+ toast . promise (
72+ deleteVideoServerFn ( {
73+ data : { videoId : deleteVideoData . id } ,
74+ } ) ,
75+ {
76+ loading : "Queueing video for deletion..." ,
77+ error : "Error deleting video" ,
78+ success : ( result ) => result . message ,
79+ }
80+ ) ;
8281 } catch ( e ) {
8382 console . error ( e ) ;
8483 reset ( ) ;
Original file line number Diff line number Diff line change @@ -110,9 +110,9 @@ function VideoCardComponent(props: VideoCardProps) {
110110 ) }
111111 { props . status === "uploading" && (
112112 < div className = "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 size-full flex items-center justify-center text-white transition-all" >
113- < Loader2Icon className = "w-24 h-24 stroke-[1px] animate-spin" />
113+ < Loader2Icon className = "w-20 h-20 stroke-[1px] animate-spin" />
114114 < span className = "text-white text-2xl font-bold absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" >
115- < NumberFlow value = { props . uploadProgress ?? 0 } /> %
115+ < NumberFlow value = { props . uploadProgress ?? 0 } />
116116 </ span >
117117 </ div >
118118 ) }
@@ -125,7 +125,7 @@ function VideoCardComponent(props: VideoCardProps) {
125125 < InfoChip icon = { FileVideoIcon } >
126126 { humanFileSize ( props . fileSizeBytes ) }
127127 </ InfoChip >
128- { props . videoLengthSeconds && (
128+ { props . videoLengthSeconds !== undefined && (
129129 < InfoChip icon = { ClockIcon } >
130130 { formatSecondsToTimestamp ( props . videoLengthSeconds ) }
131131 </ InfoChip >
Original file line number Diff line number Diff line change @@ -106,10 +106,16 @@ const fetchVideoData = createServerFn({ method: "POST" })
106106 token : env . REDIS_REST_TOKEN ,
107107 } ) ;
108108
109- const cachedVideoData = await redis . get < VideoData > ( `video:${ data . videoId } ` ) ;
109+ try {
110+ const cachedVideoData = await redis . get < VideoData > (
111+ `video:${ data . videoId } `
112+ ) ;
110113
111- if ( cachedVideoData ) {
112- return cachedVideoData ;
114+ if ( cachedVideoData ) {
115+ return cachedVideoData ;
116+ }
117+ } catch ( error ) {
118+ console . log ( error ) ;
113119 }
114120
115121 const videoData = await db . query . videos . findFirst ( {
@@ -178,9 +184,13 @@ const fetchVideoData = createServerFn({ method: "POST" })
178184 } as VideoData ;
179185
180186 if ( videoData . status === "ready" && ! videoData . isPrivate ) {
181- await redis . set ( `video:${ data . videoId } ` , fullVideoData , {
182- ex : 60 * 60 * 24 , // 1 day
183- } ) ;
187+ try {
188+ await redis . set ( `video:${ data . videoId } ` , fullVideoData , {
189+ ex : 60 * 60 * 24 , // 1 day
190+ } ) ;
191+ } catch ( error ) {
192+ console . log ( error ) ;
193+ }
184194 }
185195
186196 return fullVideoData ;
Original file line number Diff line number Diff line change @@ -88,11 +88,10 @@ export const deleteVideoServerFn = createServerFn({ method: "POST" })
8888 videoId : data . videoId ,
8989 } ) ,
9090 ] ) ;
91- } catch {
92- return {
93- success : false ,
94- message : "Failed to delete video" ,
95- } ;
91+ } catch ( error ) {
92+ console . error ( error ) ;
93+
94+ throw error ;
9695 }
9796
9897 return { success : true , message : "Video queued for deletion" } ;
You can’t perform that action at this time.
0 commit comments