2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -37,7 +37,7 @@ jobs:
|
|||||||
cache: "npm"
|
cache: "npm"
|
||||||
|
|
||||||
- name: Update npm
|
- name: Update npm
|
||||||
- run: "npm i -g npm@11.8.0"
|
run: npm i -g npm@11.8.0
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const classNames = {
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
resetErrorBoundary?: () => void;
|
resetErrorBoundary?: () => void;
|
||||||
error?: string;
|
error?: Error;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
import { Role } from "@probo/helpers";
|
import { Role } from "@probo/helpers";
|
||||||
import { lazy } from "@probo/react-lazy";
|
import { lazy } from "@probo/react-lazy";
|
||||||
import {
|
import {
|
||||||
ForbiddenError,
|
|
||||||
UnAuthenticatedError,
|
UnAuthenticatedError,
|
||||||
UnauthorizedError,
|
|
||||||
} from "@probo/relay";
|
} from "@probo/relay";
|
||||||
import { type AppRoute, routeFromAppRoute } from "@probo/routes";
|
import { type AppRoute, routeFromAppRoute } from "@probo/routes";
|
||||||
import { CenteredLayout } from "@probo/ui";
|
import { CenteredLayout } from "@probo/ui";
|
||||||
@@ -42,22 +40,14 @@ import { vendorRoutes } from "./routes/vendorRoutes";
|
|||||||
/**
|
/**
|
||||||
* Top level error boundary
|
* Top level error boundary
|
||||||
*/
|
*/
|
||||||
function ErrorBoundary({ error: propsError }: { error?: string }) {
|
function ErrorBoundary() {
|
||||||
const error = useRouteError() ?? propsError;
|
const error = useRouteError();
|
||||||
|
|
||||||
if (error instanceof UnAuthenticatedError) {
|
if (error instanceof UnAuthenticatedError) {
|
||||||
return <Navigate to="/auth/login" />;
|
return <Navigate to="/auth/login" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error instanceof UnauthorizedError) {
|
return <PageError error={error instanceof Error ? error : new Error("unkown error")} />;
|
||||||
return <PageError error="UNAUTHORIZED" />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (error instanceof ForbiddenError) {
|
|
||||||
return <PageError error="FORBIDDEN" />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <PageError error={error instanceof Error ? error.message : ""} />;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ const classNames = {
|
|||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
resetErrorBoundary?: () => void;
|
resetErrorBoundary?: () => void;
|
||||||
error?: string;
|
error?: Error;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
export function PageError({ resetErrorBoundary, error: propsError }: Props) {
|
||||||
|
|||||||
@@ -26,10 +26,10 @@ import { consoleEnvironment } from "./providers/RelayProviders.tsx";
|
|||||||
/**
|
/**
|
||||||
* Top level error boundary
|
* Top level error boundary
|
||||||
*/
|
*/
|
||||||
function ErrorBoundary({ error: propsError }: { error?: string }) {
|
function ErrorBoundary() {
|
||||||
const error = useRouteError() ?? propsError;
|
const error = useRouteError();
|
||||||
|
|
||||||
return <PageError error={error instanceof Error ? error.message : ""} />;
|
return <PageError error={error instanceof Error ? error : new Error("unkown error")} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
|
|||||||
Reference in New Issue
Block a user