Skip to content

Commit

Permalink
fix: refresh session
Browse files Browse the repository at this point in the history
  • Loading branch information
devrsi0n committed Apr 24, 2024
1 parent a5d4b3a commit 74384f5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/ui/src/hooks/use-sign-in-window.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { trpc } from '@chirpy-dev/trpc/src/client';
import { TOKEN_KEY } from '@chirpy-dev/utils';
import { useSession } from 'next-auth/react';
import { getSession } from 'next-auth/react';
import * as React from 'react';
import { z } from 'zod';

Expand All @@ -22,7 +22,6 @@ export function useSignInWindow({
}: useSignInWindowOptions = {}): () => void {
const popupWindow = React.useRef<Window | null>(null);
const utils = trpc.useContext();
const { update } = useSession();
const handleClickSignIn = () => {
popupWindow.current = popupCenterWindow(
'/auth/sign-in?allowAnonymous=true',
Expand All @@ -36,7 +35,7 @@ export function useSignInWindow({
localStorage.setItem(TOKEN_KEY, result.data.jwt);
popupWindow.current?.close();
// Refresh the session
update();
getSession();
utils.invalidate();
}
});
Expand Down

0 comments on commit 74384f5

Please sign in to comment.