fix google login

This commit is contained in:
Emily
2024-07-03 15:21:39 +02:00
parent 07a08da9de
commit 5314ba3f89
2 changed files with 11 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ export default defineNuxtConfig({
NOAUTH_USER_EMAIL: process.env.NOAUTH_USER_EMAIL,
NOAUTH_USER_NAME: process.env.NOAUTH_USER_NAME,
public: {
PAYPAL_CLIENT_ID: ''
GOOGLE_AUTH_CLIENT_ID: process.env.GOOGLE_AUTH_CLIENT_ID
}
},

View File

@@ -2,13 +2,14 @@
definePageMeta({ layout: 'none' });
const { GOOGLE_AUTH_CLIENT_ID } = useRuntimeConfig();
const config = useRuntimeConfig()
const isNoAuth = ref<boolean>(config.public.GOOGLE_AUTH_CLIENT_ID == undefined);
const isNoAuth = ref<boolean>(GOOGLE_AUTH_CLIENT_ID == undefined);
const useCodeClientWrapper = isNoAuth.value === true ? useCodeClient : (...args: any) => {
const useCodeClientWrapper = isNoAuth.value === false ?
useCodeClient :
(...args: any) => {
return { isReady: false, login: () => { } }
}
}
async function loginWithoutAuth() {
try {
@@ -31,8 +32,8 @@ async function loginWithoutAuth() {
router.push('/?just_logged=true');
}
} catch (ex) {
alert('Error during login.', ex.message);
} catch (ex: any) {
alert('Error during login.' + ex.message);
}
}