mirror of
https://github.com/formbricks/formbricks.git
synced 2026-04-28 04:36:43 -05:00
f358254e3c
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com> Co-authored-by: Johannes <johannes@formbricks.com> Co-authored-by: Matthias Nannt <mail@matthiasnannt.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
export const loginRoute = (url: string) => url === "/api/auth/callback/credentials";
|
|
|
|
export const signupRoute = (url: string) => url === "/api/v1/users";
|
|
|
|
export const clientSideApiRoute = (url: string): boolean => {
|
|
if (url.includes("/api/packages/")) return true;
|
|
if (url.includes("/api/v1/js/actions")) return true;
|
|
if (url.includes("/api/v1/client/storage")) return true;
|
|
const regex = /^\/api\/v\d+\/client\//;
|
|
return regex.test(url);
|
|
};
|
|
|
|
export const shareUrlRoute = (url: string): boolean => {
|
|
const regex = /\/share\/[A-Za-z0-9]+\/(summary|responses)/;
|
|
return regex.test(url);
|
|
};
|
|
|
|
export const isAuthProtectedRoute = (url: string): boolean => {
|
|
// List of routes that require authentication
|
|
const protectedRoutes = ["/environments", "/setup/organization", "/organizations"];
|
|
|
|
return protectedRoutes.some((route) => url.startsWith(route));
|
|
};
|
|
export const isSyncWithUserIdentificationEndpoint = (
|
|
url: string
|
|
): { environmentId: string; userId: string } | false => {
|
|
const regex = /\/api\/v1\/client\/([^/]+)\/app\/sync\/([^/]+)/;
|
|
const match = url.match(regex);
|
|
return match ? { environmentId: match[1], userId: match[2] } : false;
|
|
};
|