Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it in nuxt with SSR? #32

Open
jonalxh opened this issue Apr 26, 2021 · 0 comments
Open

How to use it in nuxt with SSR? #32

jonalxh opened this issue Apr 26, 2021 · 0 comments

Comments

@jonalxh
Copy link

jonalxh commented Apr 26, 2021

I'm trying to use this plugin with nuxt but it does not work in the server side, it says window is not defined.
I've wrapped the component inside tags but it does not work in server side.

Im using Firebase Functions for SSR deployment and this is my code:

Template side

<client-only>
            <GoogleLogin
              :params="gAuthParams"
              :onSuccess="onGoogleSignInSuccess"
              :onFailure="onGoogleSignInError"
              class="btn btn-block btn-success"
            >
              <b-icon icon="google" />
              {{ !isSignIn ? $t('signUp') : $t('signIn') }}
              {{ $t('withGoogle') }}
            </GoogleLogin>
</client-only>

Script side:

import Vue from 'vue'

import GoogleLogin from 'vue-google-login'
import { LoaderPlugin } from 'vue-google-login'
Vue.use(LoaderPlugin, {
  client_id: GoogleAuthCredentials.client_id,
})

export default {
    components: { GoogleLogin }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant