mirror of
https://github.com/StanGirard/quivr.git
synced 2024-11-24 05:55:13 +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);
|
|
}
|
|
};
|