Skip to content

Commit

Permalink
fix: redirect open twice (#60)
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei authored Jun 13, 2024
1 parent b6ea5b9 commit c774d3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/renderer/src/hooks/useAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const useSignOut = () =>

// Clear query cache
localStorage.removeItem(QUERY_PERSIST_KEY)

// Clear local storage
// TODO
}, [])
5 changes: 4 additions & 1 deletion src/renderer/src/pages/(external)/redirect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UserButton } from "@renderer/components/user-button"
import { apiClient } from "@renderer/lib/api-fetch"
import { APP_NAME } from "@renderer/lib/constants"
import { DEEPLINK_SCHEME } from "@shared/constants"
import { useEffect } from "react"
import { useEffect, useRef } from "react"
import { useNavigate } from "react-router-dom"

export function Component() {
Expand All @@ -14,7 +14,10 @@ export function Component() {
return `${DEEPLINK_SCHEME}auth?token=${data.sessionToken}`
}

const onceRef = useRef(false)
useEffect(() => {
if (onceRef.current) return
onceRef.current = true
if (window.electron) {
navigate("/")
} else {
Expand Down

0 comments on commit c774d3c

Please sign in to comment.