quivr/frontend/lib/helpers/redirectToPreviousPageOrChatPage.ts
Mamadou DICKO 2b4c3ecbbc
feat: update header and improve ux (#1164)
* feat: add Knowledge tab

* feat: use tanstack query for knowledges fetching

* feat: update header

* feat: remove upload page

* feat: make chat page the default redirection page

* feat(homePage): redirect user to chat page when already authenticated
2023-09-13 16:43:25 +02:00

12 lines
319 B
TypeScript

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);
}
};