chore: fix lint issues — move OAuth callback to lazy init, remove unused eslint-disable directives
This commit is contained in:
@@ -40,17 +40,20 @@ export function SettingsAccountsTab({ authMethods, isLoadingAuthMethods, onRefre
|
|||||||
const [isLoadingAccounts, setIsLoadingAccounts] = useState(true)
|
const [isLoadingAccounts, setIsLoadingAccounts] = useState(true)
|
||||||
const [accountsError, setAccountsError] = useState<string | null>(null)
|
const [accountsError, setAccountsError] = useState<string | null>(null)
|
||||||
const [unlinking, setUnlinking] = useState<string | null>(null)
|
const [unlinking, setUnlinking] = useState<string | null>(null)
|
||||||
const [message, setMessage] = useState<{ type: "success" | "error"; text: string } | null>(null)
|
const [message, setMessage] = useState<{ type: "success" | "error"; text: string } | null>(() => {
|
||||||
|
// Check for OAuth callback success on initial render
|
||||||
|
if (typeof window !== "undefined") {
|
||||||
|
const params = new URLSearchParams(window.location.search)
|
||||||
|
if (params.has("linked")) {
|
||||||
|
window.history.replaceState({}, "", window.location.pathname)
|
||||||
|
return { type: "success", text: "Account linked successfully!" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
})
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchAccounts()
|
fetchAccounts()
|
||||||
// Check for OAuth callback success
|
|
||||||
const params = new URLSearchParams(window.location.search)
|
|
||||||
if (params.has("linked")) {
|
|
||||||
setMessage({ type: "success", text: "Account linked successfully!" })
|
|
||||||
window.history.replaceState({}, "", window.location.pathname)
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
async function fetchAccounts() {
|
async function fetchAccounts() {
|
||||||
|
|||||||
@@ -47,7 +47,6 @@ export function SettingsSecurityTab({ authMethods, isLoadingAuthMethods, onRefre
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchPasskeys()
|
fetchPasskeys()
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
async function fetchPasskeys() {
|
async function fetchPasskeys() {
|
||||||
|
|||||||
Reference in New Issue
Block a user