20 lines
697 B
TypeScript
20 lines
697 B
TypeScript
import type { LoaderFunctionArgs } from "react-router";
|
|
import { redirect } from "react-router";
|
|
|
|
import { chatIndexPath } from "~/modules/chat/routes/chatRoutePaths";
|
|
|
|
export const loader = ({ request, params }: LoaderFunctionArgs): Response => {
|
|
const tenantSlug = params.tenant ?? "";
|
|
const source = new URL(request.url);
|
|
const target = new URL(chatIndexPath(tenantSlug), source.origin);
|
|
target.searchParams.set("archived", "true");
|
|
const query = source.searchParams.get("query");
|
|
if (query) target.searchParams.set("query", query);
|
|
return redirect(`${target.pathname}${target.search}`);
|
|
};
|
|
|
|
export const handle = {
|
|
moduleKey: "chat",
|
|
breadcrumbKey: "chat.archived.title",
|
|
};
|