1
1
mirror of https://github.com/StanGirard/quivr.git synced 2024-12-29 14:25:20 +03:00
quivr/frontend/lib/helpers/redirectToPreviousPageOrChatPage.ts

12 lines
319 B
TypeScript
Raw Normal View History

import { redirect } from "next/navigation";
export const redirectToPreviousPageOrChatPage = (): void => {
const previousPage = sessionStorage.getItem("previous-page");
if (previousPage === null) {
redirect("/chat");
} else {
sessionStorage.removeItem("previous-page");
redirect(previousPage);
}
};