Skip to content

Instantly share code, notes, and snippets.

@outoftime
Created April 1, 2018 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save outoftime/b1a650f6e7222ffbb4abc9748216b0ec to your computer and use it in GitHub Desktop.
Save outoftime/b1a650f6e7222ffbb4abc9748216b0ec to your computer and use it in GitHub Desktop.
diff --git a/src/services/gapi.js b/src/services/gapi.js
index 1be368d..345ad9f 100644
--- a/src/services/gapi.js
+++ b/src/services/gapi.js
@@ -3,13 +3,11 @@ import $S from 'scriptjs';
import once from 'lodash/once';
import config from '../config';
-export async function initGapi() {
- return new Promise((resolve) => {
- $S('https://apis.google.com/js/client.js', () => {
- resolve(gapi);
- });
+export const initGapi = once(async() => new Promise((resolve) => {
+ $S('https://apis.google.com/js/client.js', () => {
+ resolve(gapi);
});
-}
+}));
export async function initGapiClient(gapi) {
const client = await new Promise((resolve, reject) => {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment