mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-15 01:21:48 +03:00
d0b8b797f6
Co-authored-by: Zewed <dewez.antoine2@gmail.com> Co-authored-by: Antoine Dewez <44063631+Zewed@users.noreply.github.com>
12 lines
323 B
TypeScript
12 lines
323 B
TypeScript
import { redirect } from "next/navigation";
|
|
|
|
export const redirectToPreviousPageOrSearchPage = (): void => {
|
|
const previousPage = sessionStorage.getItem("previous-page");
|
|
if (previousPage === null) {
|
|
redirect("/search");
|
|
} else {
|
|
sessionStorage.removeItem("previous-page");
|
|
redirect(previousPage);
|
|
}
|
|
};
|