Przeglądaj źródła

fix(get-status): return error in case of cache retrieval failure

Nicolas Meienberger 1 rok temu
rodzic
commit
918f2b43de

+ 1 - 1
src/app/api/get-status/route.ts

@@ -8,6 +8,6 @@ export async function GET() {
 
     return Response.json({ success: true, status: status || 'RUNNING' });
   } catch (error) {
-    return Response.json({ success: false, status: 'RUNNING' });
+    return Response.json({ success: false, status: 'ERROR', error });
   }
 }

+ 1 - 0
src/client/components/hoc/StatusProvider/StatusProvider.tsx

@@ -32,6 +32,7 @@ export const StatusProvider: React.FC<IProps> = ({ children }) => {
     // If previous was not running and current is running, we need to refresh the page
     if (status === 'RUNNING' && s.current !== 'RUNNING') {
       setPollStatus(false);
+      router.push('/');
       router.refresh();
     }
     if (status === 'RUNNING') {