Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 2x 2x 2x 2x 145x 2x 145x | import { routes } from "@/routes";
import { pathNameValues, replaceRouteParam } from "../common/replaceRouteParam";
export const unauthenticatedRoutes: (typeof routes)[keyof typeof routes][] = [
routes.SIGNUP,
routes.LOGIN,
replaceRouteParam(routes.OAUTH_CALLBACK, pathNameValues.OAUTH_ID, "*"),
routes.RESET_PASSWORD,
routes.PLAYGROUND,
];
export const pathToRegex = (path: string): RegExp => {
return new RegExp(
"^" + path.replace(/[.*+?^${}()|[\]\\]/g, "\\$&").replace(/\\\*/g, ".*"),
);
};
export const isUnAuth = (path: string) =>
unauthenticatedRoutes.some((route) => pathToRegex(route).test(path));
|