Skip to content
On this page

useGsiScript

This composable loads the Google Client Library. It make sure to load the library only once. So multiple calls wont add multiple script tags to the page.

INFO

💡 This is automatically called when you use any of the provided composables such as useOneTap or using the GoogleSignInButton component.

Usage

vue
<script setup lang="ts">
import { useGsiScript } from 'vue3-google-signin';

// load GSI script
const { scriptLoaded, scriptLoadError } = useGsiScript()
</script>

Returns

ts
export type UseGsiScriptReturn = {
  /**
   * Script loaded successfully
   *
   * @type {Readonly<Ref<boolean>>}
   */
  scriptLoaded: Readonly<Ref<boolean>>;

  /**
   * Failed to load the GSI script
   *
   * @type {Readonly<Ref<boolean>>}
   */
  scriptLoadError: Readonly<Ref<boolean>>;
};

Released under the MIT License.