Skip to content

Commit

Permalink
feat(mobile): all login options are not shown after logout
Browse files Browse the repository at this point in the history
  • Loading branch information
prathameshkurunkar7 committed Mar 29, 2024
1 parent fd08db0 commit c6c352e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
10 changes: 4 additions & 6 deletions mobile/src/pages/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ export const Login = (props: ActiveScreenProps) => {
})
// GET call for Login Context (settings for social logins, email link etc)
const { data: loginContext, mutate } = useFrappeGetCall<AuthContext>('raven.api.login.get_context', {
"redirect-to": "/raven"
}, 'raven.api.login.get_context', {
revalidateIfStale: false,
revalidateOnReconnect: false,
revalidateOnFocus: false
})
"redirect-to": "/raven_mobile"
}, 'raven.api.login.get_context')
const [error, setError] = useState<FrappeError | null>(null)

const { login } = useFrappeAuth()
Expand Down Expand Up @@ -58,6 +54,8 @@ export const Login = (props: ActiveScreenProps) => {
}
}

console.log(loginContext)

return (
<>
<div className='flex flex-col gap-y-6'>
Expand Down
22 changes: 13 additions & 9 deletions mobile/src/utils/auth/UserProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,19 @@ export const UserProvider: FC<PropsWithChildren> = ({ children }) => {
const isLoggedIn = currentUser !== undefined && currentUser !== null && currentUser !== "Guest"

const handleLogout = async () => {
return logout()
.then(() => {
//Clear cache on logout
return mutate(() => true, undefined, false)
})
.then(() => {
// @ts-expect-error
window.frappePushNotification?.disableNotification()
})
// @ts-expect-error
window.frappePushNotification?.disableNotification()
.then(() => logout())
.then(() => {
//Clear cache on logout
return mutate((key) => {
if (key === 'raven.api.login.get_context'){
return false
}
return true
}, undefined, false)
})

}

const handleLogin = async (username: string, password: string) => {
Expand Down

0 comments on commit c6c352e

Please sign in to comment.