From 6b4601158945aac92cbf5fe59557d8476107e3cc Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Fri, 26 Sep 2025 18:32:16 +0000 Subject: [PATCH 1/2] remove revoke call --- src/components/Layout/useLogin.ts | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/components/Layout/useLogin.ts b/src/components/Layout/useLogin.ts index b3be6c42..4326815d 100644 --- a/src/components/Layout/useLogin.ts +++ b/src/components/Layout/useLogin.ts @@ -36,15 +36,10 @@ const useLogin = (): Requestable => { }, [tokenClient]) const logout = useCallback(() => { - const token = gapi?.client.getToken() - if (token && google) { - google.accounts.oauth2.revoke(token.access_token, () => { - gapi?.client.setToken(null) - dispatch({ type: "setToken", token: undefined }) - localStorage.removeItem("google_token") - }) - } - }, [gapi, google, dispatch]) + gapi?.client.setToken(null) + dispatch({ type: "setToken", token: undefined }) + localStorage.removeItem("google_token") + }, [gapi, dispatch]) useEffect(() => { if (gapiStatus === "cannot initialize") { From 24c9eedd1dcf8ebcd0f3646b0a229ccb9504915b Mon Sep 17 00:00:00 2001 From: Lindsey Volta Date: Fri, 26 Sep 2025 19:13:00 +0000 Subject: [PATCH 2/2] cleanup --- gatsby/onInitialClientRender.js | 1 - gatsby/wrapRootElement.tsx | 6 +----- src/components/Layout/useLogin.ts | 1 - src/global.d.ts | 1 - 4 files changed, 1 insertion(+), 8 deletions(-) diff --git a/gatsby/onInitialClientRender.js b/gatsby/onInitialClientRender.js index 781b8e9d..f2500cf8 100644 --- a/gatsby/onInitialClientRender.js +++ b/gatsby/onInitialClientRender.js @@ -83,7 +83,6 @@ export const onInitialClientRender = () => { store.dispatch({ type: "setGapi", gapi }) store.dispatch({ type: "gapiStatus", status: "initialized" }) - store.dispatch({ type: "setGoogle", google }) store.dispatch({ type: "setTokenClient", tokenClient }) }) .catch(e => { diff --git a/gatsby/wrapRootElement.tsx b/gatsby/wrapRootElement.tsx index 970898d6..db60f70d 100644 --- a/gatsby/wrapRootElement.tsx +++ b/gatsby/wrapRootElement.tsx @@ -18,9 +18,8 @@ import {PartialDeep} from 'type-fest'; type State = { - token?: {}, + token?: { }, gapi?: PartialDeep, - google?: any, tokenClient?: any, toast?: string, gapiStatus?: string @@ -29,7 +28,6 @@ type State = type Action = | { type: 'setToken', token: {} | undefined } | { type: 'setGapi', gapi: PartialDeep | undefined } - | { type: 'setGoogle', google: any } | { type: 'setTokenClient', tokenClient: any } | { type: 'setToast', toast: string | undefined } | { type: 'gapiStatus', status: string | undefined }; @@ -39,8 +37,6 @@ const reducer = (state: State = {}, action: Action) => { return { ...state, token: action.token } case "setGapi": return { ...state, gapi: action.gapi } - case "setGoogle": - return { ...state, google: action.google } case "setTokenClient": return { ...state, tokenClient: action.tokenClient } case "setToast": diff --git a/src/components/Layout/useLogin.ts b/src/components/Layout/useLogin.ts index 4326815d..39a683bc 100644 --- a/src/components/Layout/useLogin.ts +++ b/src/components/Layout/useLogin.ts @@ -25,7 +25,6 @@ const useLogin = (): Requestable => { const gapi = useSelector((state: AppState) => state.gapi) const gapiStatus = useSelector((state: AppState) => state.gapiStatus) const tokenClient = useSelector((state: AppState) => state.tokenClient) - const google = useSelector((state: AppState) => state.google) const dispatch = useDispatch() const userStatus = token ? UserStatus.SignedIn : UserStatus.SignedOut diff --git a/src/global.d.ts b/src/global.d.ts index 023f31ab..2c33ab8c 100644 --- a/src/global.d.ts +++ b/src/global.d.ts @@ -28,5 +28,4 @@ declare interface AppState { gapiStatus?: string measurementID: string tokenClient?: any - google?: typeof google }