Skip to content

Commit

Permalink
fix: resolve ESLint issues in switch-account.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
JMoises-XCode committed Feb 26, 2025
1 parent 92cbf4a commit 1e84ab9
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions app/screens/settings-screen/settings/switch-account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,19 @@ export const SwitchAccount: React.FC = () => {
const existingProfileIndex = findExistingProfileIndex(profiles, data)

if (existingProfileIndex === -1) {
profiles.push(createProfile(data, token, counter))
profiles.push({
userid: data.me?.id,
username: data.me?.username || data.me?.phone || `Blink User ${counter}`,
token,
selected: token === curToken,
})
} else {
// Avoid duplicate account data and clear store
await KeyStoreWrapper.updateAllTokens(token)
}
counter = counter + 1
} else {
// Remove token if invalid
// Remove invalid token
await KeyStoreWrapper.updateAllTokens(token)
}
} catch (err) {
Expand All @@ -117,16 +122,6 @@ export const SwitchAccount: React.FC = () => {
)
}

const createProfile = (userData: UsernameQuery, token: string, counter: number) => ({
userid: userData.me?.id,
username:
userData.me?.username ||
userData.me?.phone ||
`${LL.common.blinkUser()} ${counter}`,
token,
selected: token === curToken,
})

useEffect(() => {
if (prevTokenRef.current !== persistentState.galoyAuthToken) {
// Navigate to home when token is updated and different from the previous token
Expand Down

0 comments on commit 1e84ab9

Please sign in to comment.