better error handling

This commit is contained in:
spencerwooo
2022-01-10 16:36:45 +08:00
parent aa3986cb76
commit 02f03b41bf
3 changed files with 49 additions and 38 deletions
+2 -2
View File
@@ -184,14 +184,14 @@ const FileListing: FC<{ query?: ParsedUrlQuery }> = ({ query }) => {
console.log(error)
// If error includes 403 which means the user has not completed initial setup, redirect to OAuth page
if (error.message.includes('403')) {
if (error.status === 403) {
router.push('/onedrive-vercel-index-oauth/step-1')
return <div></div>
}
return (
<PreviewContainer>
{error.message.includes('401') ? <Auth redirect={path} /> : <FourOhFour errorMsg={error.message} />}
{error.status === 401 ? <Auth redirect={path} /> : <FourOhFour errorMsg={JSON.stringify(error.message)} />}
</PreviewContainer>
)
}