Skip to content

Commit b4a008c

Browse files
Merge pull request #65 from wafflestudio/fix/social-login
fix: update Google account linking to use fetch and improve callback …
2 parents ab06f0d + dbd79e6 commit b4a008c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/api/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ export const linkGoogleAccount = async (
13461346
): Promise<{ success: boolean; data?: GoogleLinkResponse; error?: string }> => {
13471347
try {
13481348
const accessToken = getAccessToken();
1349-
const response = await authFetch('/api/auth/google/link', {
1349+
const response = await fetch('/api/auth/google/link', {
13501350
method: 'POST',
13511351
headers: {
13521352
'Content-Type': 'application/json',

src/pages/GoogleCallbackPage.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export function GoogleCallbackPage() {
1515
const isProcessed = useRef(false);
1616

1717
useEffect(() => {
18+
if (isProcessed.current) return;
1819
const handleCallback = async () => {
1920
const code = searchParams.get('code');
2021
const state = searchParams.get('state');
@@ -46,10 +47,9 @@ export function GoogleCallbackPage() {
4647
return;
4748
}
4849

49-
isProcessed.current = true;
50-
5150
const redirectUri = `${window.location.origin}/auth/google/callback`;
5251

52+
isProcessed.current = true;
5353
try {
5454
if (pkceData.mode === 'link') {
5555
const result = await linkGoogleAccount(code, pkceData.codeVerifier, redirectUri);

0 commit comments

Comments
 (0)