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

This commit is contained in:
Nicolas Meienberger 2023-10-15 14:27:09 +02:00
parent 2cff0de4ac
commit 918f2b43de
2 changed files with 2 additions and 1 deletions

View file

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

View file

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