Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

some other improvements

Blue Moused56bd36f39be
diff --git a/src/api/index.ts b/src/api/index.ts
index 27b40b708..9148b7be9 100644
--- a/src/api/index.ts
+++ b/src/api/index.ts
@@ -811,7 +811,7 @@ export const confirmTransferProject = (uuid: string) =>
export const googleAuth = (data: any) =>
api
- .post('google-auth', data)
+ .post('v1/auth/google', data)
.then((response): unknown => response.data)
.catch((error) => {
debug('%s', error)
diff --git a/src/components/GoogleAuth.tsx b/src/components/GoogleAuth.tsx
index 82d74f9d5..43fdaa763 100644
--- a/src/components/GoogleAuth.tsx
+++ b/src/components/GoogleAuth.tsx
@@ -26,7 +26,7 @@ interface IGoogleAuth {
const GoogleAuth: React.FC<IGoogleAuth> = ({ setIsLoading }) => {
const { t } = useTranslation()
- const actualGoogleButton = useRef(null)
+ const actualGoogleButton = useRef<HTMLDivElement>(null)
const handleCredentialResponse = async (response: any) => {
const result = await googleAuth({ token: response.credential })
@@ -59,9 +59,20 @@ const GoogleAuth: React.FC<IGoogleAuth> = ({ setIsLoading }) => {
const clickGoogleLoginButton = () => {
if (actualGoogleButton.current) {
// @ts-ignore
- const iframe = actualGoogleButton.current.querySelector('iframe')
+ const iframe = actualGoogleButton.current.querySelector('iframe') as HTMLIFrameElement
// Emulating the click on an actial 'Sign in with Google' button
- iframe.nextElementSibling.click()
+
+ // Works for Firefox
+ if (iframe.nextElementSibling) {
+ // @ts-ignore
+ iframe.nextElementSibling.click()
+ }
+
+ // Works for Chrome
+ if (iframe.previousElementSibling) {
+ // idk how to make it work for Chrome yet so just displaying the google button itself
+ actualGoogleButton.current.className = ''
+ }
}
}