gapi-oauth-react-hooks
Advanced tools
Comparing version 2.0.3 to 2.0.4
/// <reference types="gapi.auth2" /> | ||
/// <reference types="react" /> | ||
import { GapiState } from "../types/gapiState"; | ||
import { UserProfile } from "../types/user.profile"; | ||
interface GapiLoadingHookProps { | ||
state: GapiState; | ||
signedUser?: gapi.auth2.BasicProfile; | ||
signedUser?: UserProfile; | ||
authResponse?: gapi.auth2.AuthResponse; | ||
setState: React.Dispatch<React.SetStateAction<GapiState>>; | ||
setSignedUser: React.Dispatch<React.SetStateAction<gapi.auth2.BasicProfile | undefined>>; | ||
setSignedUser: React.Dispatch<React.SetStateAction<UserProfile | undefined>>; | ||
setAuthResponse: React.Dispatch<React.SetStateAction<gapi.auth2.AuthResponse | undefined>>; | ||
@@ -11,0 +12,0 @@ } |
@@ -38,3 +38,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { useEffect, useState } from "react"; | ||
import { gapiAuth2Init, gapiGetAuth2Instance, gapiLoad } from "../indirection/gapi.lib.indirection"; | ||
import { gapiAuth2Init, gapiGetAuth2Instance, gapiLoad, } from "../indirection/gapi.lib.indirection"; | ||
import { asPlainObject } from "../logic/conversion.logic"; | ||
import { loadScript, removeScript } from "../logic/resource.loading.logic"; | ||
@@ -51,3 +52,3 @@ import { useGapiConfig } from "./use.gapi.config.hook"; | ||
setAuthResponse(currentUser.getAuthResponse()); | ||
setSignedUser(currentUser.getBasicProfile()); | ||
setSignedUser(asPlainObject(currentUser.getBasicProfile())); | ||
setState("SignedIn"); | ||
@@ -54,0 +55,0 @@ } |
/// <reference types="gapi.auth2" /> | ||
import { GapiState } from "../types/gapiState"; | ||
import { UserProfile } from "../types/user.profile"; | ||
export interface GoogleAuthHookProps { | ||
state: GapiState; | ||
signedUser?: gapi.auth2.BasicProfile; | ||
signedUser?: UserProfile; | ||
authResponse?: gapi.auth2.AuthResponse; | ||
@@ -7,0 +8,0 @@ onSignIn: () => Promise<void>; |
@@ -38,2 +38,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { gapiGetAuth2Instance } from "../indirection/gapi.lib.indirection"; | ||
import { asPlainObject } from "../logic/conversion.logic"; | ||
import { useGapiLoading } from "./use.gapi.loading.hook"; | ||
@@ -57,3 +58,3 @@ export var useGoogleAuth = function () { | ||
setAuthResponse(user.getAuthResponse()); | ||
setSignedUser(user.getBasicProfile()); | ||
setSignedUser(asPlainObject(user.getBasicProfile())); | ||
setState("SignedIn"); | ||
@@ -60,0 +61,0 @@ return [3 /*break*/, 4]; |
import { GoogleAuthHookProps, useGoogleAuth } from "./hooks/use.google.auth.hook"; | ||
import { GapiConfig } from "./logic/gapi.config.logic"; | ||
import { GapiState } from "./types/gapiState"; | ||
import { UserProfile } from "./types/user.profile"; | ||
export { useGoogleAuth, GapiConfig }; | ||
export type { GoogleAuthHookProps }; | ||
export type { GapiState }; | ||
export type { UserProfile }; |
@@ -1,3 +0,3 @@ | ||
import { useGoogleAuth } from "./hooks/use.google.auth.hook"; | ||
import { useGoogleAuth, } from "./hooks/use.google.auth.hook"; | ||
import { GapiConfig } from "./logic/gapi.config.logic"; | ||
export { useGoogleAuth, GapiConfig }; |
{ | ||
"name": "gapi-oauth-react-hooks", | ||
"version": "2.0.3", | ||
"version": "2.0.4", | ||
"repository": "https://github.com/jpb06/gapi-oauth-react-hooks.git", | ||
@@ -5,0 +5,0 @@ "author": "jpb06 <jpb.06@outlook.com>", |
@@ -48,3 +48,3 @@ # gapi-oauth-react-hooks | ||
```Typescript | ||
import { useGoogleAuth } from "gapi-oauth-react-hooks"; | ||
import { useGoogleAuth, UserProfile } from "gapi-oauth-react-hooks"; | ||
@@ -66,3 +66,3 @@ export const Login = () => { | ||
onSignOut: () => Promise<void>; | ||
signedUser?: gapi.auth2.BasicProfile; | ||
signedUser?: UserProfile; | ||
authResponse?: gapi.auth2.AuthResponse; | ||
@@ -113,2 +113,3 @@ } | ||
- 2.0.4 : Returning a plain object for user profile. | ||
- 2.0.3 : Yet another readme example improvement. | ||
@@ -115,0 +116,0 @@ - 2.0.2 : Typo & missing export in index. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
19916
22
310
130