Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix ts

Sara Vieiraaed24fcc7c45
diff --git a/app/routes/auth/dev.tsx b/app/routes/auth/dev.tsx
index 2e20c451e1..b35442f343 100644
--- a/app/routes/auth/dev.tsx
+++ b/app/routes/auth/dev.tsx
@@ -13,14 +13,15 @@ export const action: ActionFunction = async ({ request }) => {
successRedirect: config.dashboardPath,
throwOnError: true,
});
- } catch (error: any) {
+ } catch (error: unknown) {
// all redirects are basically errors and in that case we don't want to catch it
if (error instanceof Response) return error;
- console.log(error);
- return redirect(
- `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_DEV}&message=${
- error?.message || ""
- }`
- );
+ if (error instanceof Error) {
+ return redirect(
+ `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_DEV}&message=${
+ error?.message || ""
+ }`
+ );
+ }
}
};
diff --git a/app/routes/auth/github.tsx b/app/routes/auth/github.tsx
index f6537a7aca..7b8486e8f0 100644
--- a/app/routes/auth/github.tsx
+++ b/app/routes/auth/github.tsx
@@ -18,14 +18,16 @@ export const action: ActionFunction = async ({ request }) => {
successRedirect: config.dashboardPath,
throwOnError: true,
});
- } catch (error: any) {
+ } catch (error: unknown) {
// all redirects are basically errors and in that case we don't want to catch it
if (error instanceof Response) return error;
- console.log(error);
- return redirect(
- `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_GITHUB}&message=${
- error?.message || ""
- }`
- );
+ if (error instanceof Error) {
+ console.log(error);
+ return redirect(
+ `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_GITHUB}&message=${
+ error?.message || ""
+ }`
+ );
+ }
}
};
diff --git a/app/routes/auth/google.tsx b/app/routes/auth/google.tsx
index 985b6afd82..ccabf94682 100644
--- a/app/routes/auth/google.tsx
+++ b/app/routes/auth/google.tsx
@@ -20,14 +20,16 @@ export const action: ActionFunction = async ({ request }) => {
successRedirect: config.dashboardPath,
throwOnError: true,
});
- } catch (error: any) {
+ } catch (error: unknown) {
// all redirects are basically errors and in that case we don't want to catch it
if (error instanceof Response) return error;
- console.log(error);
- return redirect(
- `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_GOOGLE}&message=${
- error?.message || ""
- }`
- );
+ if (error instanceof Error) {
+ console.log(error);
+ return redirect(
+ `${config.loginPath}?error=${LOGIN_ERROR_CODES.LOGIN_GOOGLE}&message=${
+ error?.message || ""
+ }`
+ );
+ }
}
};
diff --git a/app/services/auth.server.ts b/app/services/auth.server.ts
index d7f7aaa6cc..57294f428d 100644
--- a/app/services/auth.server.ts
+++ b/app/services/auth.server.ts
@@ -60,8 +60,10 @@ if (process.env.DEV_LOGIN === "true") {
try {
const user = await createOrLoginWithDev(secret);
return user;
- } catch (error: any) {
- throw new Error(error);
+ } catch (error) {
+ if (error instanceof Error) {
+ throw new Error(error?.message);
+ }
}
}