Skip to content
This repository was archived by the owner on Feb 22, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function Sidebar({ auth }: { auth: AuthData }) {
const fetcher = useFetcher();
const { isOpen, onOpen, onClose } = useDisclosure();

const logoutHandler = () => {
const logoutHandler = () => {
fetcher.submit(null, {
method: "post",
action: `/logout/action`,
Expand Down
2 changes: 1 addition & 1 deletion app/entry.server.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { renderToString } from "react-dom/server";
import { CacheProvider } from "@emotion/react";
import createEmotionServer from "@emotion/server/create-instance";
import { RemixServer } from "@remix-run/react";
import type { EntryContext } from "@remix-run/node"; // Depends on the runtime you choose
import { type EntryContext } from "@remix-run/node"; // Depends on the runtime you choose

import { ServerStyleContext } from "./context";
import createEmotionCache from "./createEmotionCache";
Expand Down
20 changes: 17 additions & 3 deletions app/errors/base.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import { useRouteError, isRouteErrorResponse } from "@remix-run/react";
import { useRouteError, isRouteErrorResponse, useNavigate, useFetcher } from "@remix-run/react";
import { useEffect } from "react";

export const BaseError = () => {
const error = useRouteError();
const error: any = useRouteError();
const navigate = useNavigate();
const fetcher = useFetcher();

useEffect(() => {
if (typeof error.message === "string" && error.message.includes("401")) {
// redirect to logout action
fetcher.submit(null, {
method: "post",
action: `/logout/action`,
});
}
}, [error, navigate]);

if (isRouteErrorResponse(error)) {
console.log(`App Error(isRouteErrorResponse) = ${error}`);
} else {
console.log(`App Error = ${error}`);
console.log(`App sssError = ${error}`);
}

return <>here in error section</>;
Expand Down
2 changes: 1 addition & 1 deletion app/middlewares/with-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function withAuth(fn: LoaderFunction): LoaderFunction {
const excludedRoutes = ["/login", "/signup"];
const { url } = args.request
const isExcludedRoute = excludedRoutes.some(route => url.includes(route));

// return to login if dont have valid auth info
if (!data?.token && !isExcludedRoute) {
return redirect("/login");
Expand Down
18 changes: 8 additions & 10 deletions app/models/backoffice/backoffice-cookie.server.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import invariant from "tiny-invariant";
import { createFileSessionStorage, createCookie } from "@remix-run/node";
import { createCookieSessionStorage } from "@remix-run/node";

const { COOKIE_SECRET} = process.env;
const { COOKIE_SECRET } = process.env;
invariant(typeof COOKIE_SECRET === "string", "COOKIE_SECRET env var not set");

const backofficeSession = createCookie("backofficeSession", {
secrets: [COOKIE_SECRET!]
});

export const { getSession, commitSession, destroySession } = createFileSessionStorage({
dir: "./sessions",
cookie: backofficeSession,
});
export const { getSession, commitSession, destroySession } = createCookieSessionStorage({
cookie: {
name: "backofficeSession",
secrets: [COOKIE_SECRET!]
},
});
31 changes: 0 additions & 31 deletions app/models/jobs.server.ts

This file was deleted.

4 changes: 0 additions & 4 deletions app/models/jobs/index.ts

This file was deleted.

114 changes: 0 additions & 114 deletions app/models/jobs/jobs.ts

This file was deleted.

20 changes: 0 additions & 20 deletions app/models/jobs/requests.ts

This file was deleted.

72 changes: 0 additions & 72 deletions app/models/jobs/types.ts

This file was deleted.

8 changes: 4 additions & 4 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React, { useContext, useEffect } from "react";
import { withEmotionCache } from "@emotion/react";
import { ChakraProvider } from "@chakra-ui/react";
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
import type { V2_MetaFunction, LinksFunction } from "@remix-run/node"; // Depends on the runtime you choose
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration, useLoaderData, useFetcher } from "@remix-run/react";
import { type V2_MetaFunction, type LinksFunction, type LoaderFunction, redirect, LoaderArgs } from "@remix-run/node"; // Depends on the runtime you choose
import { metaV1 } from "@remix-run/v1-meta";

import { ServerStyleContext, ClientStyleContext } from "./context";
Expand Down Expand Up @@ -77,11 +77,11 @@ const Document = withEmotionCache(({ children }: DocumentProps, emotionCache) =>
);
});

export default function App() {
export default function App() {
return (
<Document>
<ChakraProvider theme={theme}>
<Outlet />
<Outlet />
</ChakraProvider>
</Document>
);
Expand Down
Loading