fix: propagate API error data to handle protected dashboards correctly
This commit is contained in:
@@ -74,9 +74,9 @@ export default function PublicDashboardPage() {
|
||||
setData(dashboardData)
|
||||
setIsPasswordProtected(false)
|
||||
} catch (error: any) {
|
||||
if (error.response?.status === 401 && error.response?.data?.is_protected) {
|
||||
if ((error.status === 401 || error.response?.status === 401) && (error.data?.is_protected || error.response?.data?.is_protected)) {
|
||||
setIsPasswordProtected(true)
|
||||
} else if (error.response?.status === 404) {
|
||||
} else if (error.status === 404 || error.response?.status === 404) {
|
||||
toast.error('Site not found')
|
||||
} else if (!silent) {
|
||||
toast.error('Failed to load dashboard: ' + (error.message || 'Unknown error'))
|
||||
|
||||
Reference in New Issue
Block a user