From 8592cf2d0716063e8e422215f8a610d342bf31ec Mon Sep 17 00:00:00 2001 From: Allen Zhou <46854522+allenzhou101@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:22:11 -0800 Subject: [PATCH] Run prettier-fix --- client/src/components/OAuthCallback.tsx | 5 ++++- client/src/lib/auth.ts | 8 +++++--- client/src/lib/hooks/useConnection.ts | 5 ++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/client/src/components/OAuthCallback.tsx b/client/src/components/OAuthCallback.tsx index 2a9e27a..869eef1 100644 --- a/client/src/components/OAuthCallback.tsx +++ b/client/src/components/OAuthCallback.tsx @@ -28,7 +28,10 @@ const OAuthCallback = () => { // Store both access and refresh tokens sessionStorage.setItem(SESSION_KEYS.ACCESS_TOKEN, tokens.access_token); if (tokens.refresh_token) { - sessionStorage.setItem(SESSION_KEYS.REFRESH_TOKEN, tokens.refresh_token); + sessionStorage.setItem( + SESSION_KEYS.REFRESH_TOKEN, + tokens.refresh_token, + ); } // Redirect back to the main app with server URL to trigger auto-connect window.location.href = `/?serverUrl=${encodeURIComponent(serverUrl)}`; diff --git a/client/src/lib/auth.ts b/client/src/lib/auth.ts index 7d70a31..918ac4d 100644 --- a/client/src/lib/auth.ts +++ b/client/src/lib/auth.ts @@ -97,14 +97,16 @@ export async function handleOAuthCallback( return data; } -export async function refreshAccessToken(serverUrl: string): Promise { +export async function refreshAccessToken( + serverUrl: string, +): Promise { const refreshToken = sessionStorage.getItem(SESSION_KEYS.REFRESH_TOKEN); if (!refreshToken) { throw new Error("No refresh token available"); } const metadata = await discoverOAuthMetadata(serverUrl); - + const response = await fetch(metadata.token_endpoint, { method: "POST", headers: { @@ -112,7 +114,7 @@ export async function refreshAccessToken(serverUrl: string): Promise