refactor: add error components at page level
This commit is contained in:
parent
39469cb08b
commit
e86fcf1b9a
18 changed files with 20 additions and 8 deletions
|
|
@ -3,6 +3,7 @@ import { DownloadRecoveryKeyPage } from "~/client/modules/auth/routes/download-r
|
||||||
|
|
||||||
export const Route = createFileRoute("/(auth)/download-recovery-key")({
|
export const Route = createFileRoute("/(auth)/download-recovery-key")({
|
||||||
component: DownloadRecoveryKeyPage,
|
component: DownloadRecoveryKeyPage,
|
||||||
|
errorComponent: () => <div>Failed to load recovery key</div>,
|
||||||
head: () => ({
|
head: () => ({
|
||||||
meta: [
|
meta: [
|
||||||
{ title: "Zerobyte - Download Recovery Key" },
|
{ title: "Zerobyte - Download Recovery Key" },
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { LoginPage } from "~/client/modules/auth/routes/login";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(auth)/login/error")({
|
export const Route = createFileRoute("/(auth)/login/error")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load login error</div>,
|
||||||
validateSearch: type({ error: "string?" }),
|
validateSearch: type({ error: "string?" }),
|
||||||
head: () => ({
|
head: () => ({
|
||||||
meta: [
|
meta: [
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { LoginPage } from "~/client/modules/auth/routes/login";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(auth)/login")({
|
export const Route = createFileRoute("/(auth)/login")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load login</div>,
|
||||||
validateSearch: type({ error: "string?" }),
|
validateSearch: type({ error: "string?" }),
|
||||||
head: () => ({
|
head: () => ({
|
||||||
meta: [
|
meta: [
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { OnboardingPage } from "~/client/modules/auth/routes/onboarding";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(auth)/onboarding")({
|
export const Route = createFileRoute("/(auth)/onboarding")({
|
||||||
component: OnboardingPage,
|
component: OnboardingPage,
|
||||||
|
errorComponent: () => <div>Failed to load onboarding</div>,
|
||||||
head: () => ({
|
head: () => ({
|
||||||
meta: [
|
meta: [
|
||||||
{ title: "Zerobyte - Onboarding" },
|
{ title: "Zerobyte - Onboarding" },
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { authMiddleware } from "~/middleware/auth";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(auth)")({
|
export const Route = createFileRoute("/(auth)")({
|
||||||
component: () => <Outlet />,
|
component: () => <Outlet />,
|
||||||
|
errorComponent: () => <div>Failed to load auth</div>,
|
||||||
server: {
|
server: {
|
||||||
middleware: [authMiddleware],
|
middleware: [authMiddleware],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import { getAdminUsersOptions, getRegistrationStatusOptions } from "~/client/api
|
||||||
export const Route = createFileRoute("/(dashboard)/admin/")({
|
export const Route = createFileRoute("/(dashboard)/admin/")({
|
||||||
validateSearch: type({ tab: "string?" }),
|
validateSearch: type({ tab: "string?" }),
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load admin</div>,
|
||||||
loader: async ({ context }) => {
|
loader: async ({ context }) => {
|
||||||
const authContext = await fetchUser();
|
const authContext = await fetchUser();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ import { getVolumeMountPath } from "~/client/lib/volume-path";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/backups/$backupId/$snapshotId/restore")({
|
export const Route = createFileRoute("/(dashboard)/backups/$backupId/$snapshotId/restore")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load restore</div>,
|
||||||
loader: async ({ params, context }) => {
|
loader: async ({ params, context }) => {
|
||||||
const schedule = await getBackupSchedule({ path: { shortId: params.backupId } });
|
const schedule = await getBackupSchedule({ path: { shortId: params.backupId } });
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ import { prefetchOrSkip } from "~/utils/prefetch";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/backups/$backupId/")({
|
export const Route = createFileRoute("/(dashboard)/backups/$backupId/")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load backup</div>,
|
||||||
validateSearch: type({ snapshot: "string?" }),
|
validateSearch: type({ snapshot: "string?" }),
|
||||||
loader: async ({ params, context }) => {
|
loader: async ({ params, context }) => {
|
||||||
const { backupId } = params;
|
const { backupId } = params;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { listRepositoriesOptions, listVolumesOptions } from "~/client/api-client
|
||||||
import { CreateBackupPage } from "~/client/modules/backups/routes/create-backup";
|
import { CreateBackupPage } from "~/client/modules/backups/routes/create-backup";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/backups/create")({
|
export const Route = createFileRoute("/(dashboard)/backups/create")({
|
||||||
|
errorComponent: () => <div>Failed to load backup creation</div>,
|
||||||
loader: async ({ context }) => {
|
loader: async ({ context }) => {
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
context.queryClient.ensureQueryData({ ...listVolumesOptions() }),
|
context.queryClient.ensureQueryData({ ...listVolumesOptions() }),
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { BackupsPage } from "~/client/modules/backups/routes/backups";
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/backups/")({
|
export const Route = createFileRoute("/(dashboard)/backups/")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load backups</div>,
|
||||||
loader: async ({ context }) => {
|
loader: async ({ context }) => {
|
||||||
await context.queryClient.ensureQueryData({
|
await context.queryClient.ensureQueryData({
|
||||||
...listBackupSchedulesOptions(),
|
...listBackupSchedulesOptions(),
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { NotificationDetailsPage } from "~/client/modules/notifications/routes/n
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/notifications/$notificationId")({
|
export const Route = createFileRoute("/(dashboard)/notifications/$notificationId")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load notification</div>,
|
||||||
loader: async ({ params, context }) => {
|
loader: async ({ params, context }) => {
|
||||||
const res = await context.queryClient.ensureQueryData({
|
const res = await context.queryClient.ensureQueryData({
|
||||||
...getNotificationDestinationOptions({ path: { id: params.notificationId } }),
|
...getNotificationDestinationOptions({ path: { id: params.notificationId } }),
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,9 @@ import { CreateNotificationPage } from "~/client/modules/notifications/routes/cr
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/notifications/create")({
|
export const Route = createFileRoute("/(dashboard)/notifications/create")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load notification creation</div>,
|
||||||
staticData: {
|
staticData: {
|
||||||
breadcrumb: () => [
|
breadcrumb: () => [{ label: "Notifications", href: "/notifications" }, { label: "Create" }],
|
||||||
{ label: "Notifications", href: "/notifications" },
|
|
||||||
{ label: "Create" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
head: () => ({
|
head: () => ({
|
||||||
meta: [
|
meta: [
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { NotificationsPage } from "~/client/modules/notifications/routes/notific
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/notifications/")({
|
export const Route = createFileRoute("/(dashboard)/notifications/")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load notifications</div>,
|
||||||
loader: async ({ context }) => {
|
loader: async ({ context }) => {
|
||||||
await context.queryClient.ensureQueryData({ ...listNotificationDestinationsOptions() });
|
await context.queryClient.ensureQueryData({ ...listNotificationDestinationsOptions() });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -3,11 +3,9 @@ import { CreateRepositoryPage } from "~/client/modules/repositories/routes/creat
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/repositories/create")({
|
export const Route = createFileRoute("/(dashboard)/repositories/create")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load repository creation</div>,
|
||||||
staticData: {
|
staticData: {
|
||||||
breadcrumb: () => [
|
breadcrumb: () => [{ label: "Repositories", href: "/repositories" }, { label: "Create" }],
|
||||||
{ label: "Repositories", href: "/repositories" },
|
|
||||||
{ label: "Create" },
|
|
||||||
],
|
|
||||||
},
|
},
|
||||||
head: () => ({
|
head: () => ({
|
||||||
meta: [
|
meta: [
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { getOrganizationContext } from "~/server/lib/functions/organization-cont
|
||||||
export const Route = createFileRoute("/(dashboard)/settings/")({
|
export const Route = createFileRoute("/(dashboard)/settings/")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
validateSearch: type({ tab: "string?" }),
|
validateSearch: type({ tab: "string?" }),
|
||||||
|
errorComponent: () => <div>Failed to load settings</div>,
|
||||||
loader: async ({ context }) => {
|
loader: async ({ context }) => {
|
||||||
const authContext = await fetchUser();
|
const authContext = await fetchUser();
|
||||||
const orgContext = await getOrganizationContext();
|
const orgContext = await getOrganizationContext();
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { getOrganizationContext } from "~/server/lib/functions/organization-cont
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/settings/sso/new")({
|
export const Route = createFileRoute("/(dashboard)/settings/sso/new")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load SSO registration</div>,
|
||||||
loader: async () => {
|
loader: async () => {
|
||||||
const orgContext = await getOrganizationContext();
|
const orgContext = await getOrganizationContext();
|
||||||
const role = orgContext.activeMember?.role;
|
const role = orgContext.activeMember?.role;
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { CreateVolumePage } from "~/client/modules/volumes/routes/create-volume"
|
||||||
|
|
||||||
export const Route = createFileRoute("/(dashboard)/volumes/create")({
|
export const Route = createFileRoute("/(dashboard)/volumes/create")({
|
||||||
component: RouteComponent,
|
component: RouteComponent,
|
||||||
|
errorComponent: () => <div>Failed to load volume creation</div>,
|
||||||
staticData: {
|
staticData: {
|
||||||
breadcrumb: () => [{ label: "Volumes", href: "/volumes" }, { label: "Create" }],
|
breadcrumb: () => [{ label: "Volumes", href: "/volumes" }, { label: "Create" }],
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export const Route = createFileRoute("/")({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
errorComponent: () => <div>Failed to load page</div>,
|
||||||
beforeLoad: () => {
|
beforeLoad: () => {
|
||||||
throw redirect({ to: "/volumes" });
|
throw redirect({ to: "/volumes" });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue