Skip to content

Commit

Permalink
fix: logout
Browse files Browse the repository at this point in the history
  • Loading branch information
yashim-deriv committed Jul 31, 2024
1 parent dfcc9fc commit 00404fc
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@babel/preset-env": "^7.24.5",
"@chakra-ui/react": "^2.8.2",
"@deriv-com/analytics": "^1.10.1",
"@deriv-com/api-hooks": "^1.4.5",
"@deriv-com/api-hooks": "^1.4.7",
"@deriv-com/translations": "^1.2.4",
"@deriv-com/ui": "^1.29.0",
"@deriv-com/utils": "^0.0.28",
Expand Down
12 changes: 10 additions & 2 deletions src/components/AppHeader/AppHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getOauthUrl } from '@/constants';
import { api } from '@/hooks';
import { api, useRedirectToOauth } from '@/hooks';
import { getCurrentRoute } from '@/utils';
import { StandaloneCircleUserRegularIcon } from '@deriv/quill-icons';
import { useAuthData } from '@deriv-com/api-hooks';
Expand All @@ -19,6 +19,7 @@ import './AppHeader.scss';
const AppHeader = () => {
const { isDesktop } = useDevice();
const isEndpointPage = getCurrentRoute() === 'endpoint';
const { redirectToOauth } = useRedirectToOauth();
const { activeLoginid, logout } = useAuthData();
const { data: activeAccount } = api.account.useActiveAccount();
const { localize } = useTranslations();
Expand Down Expand Up @@ -46,7 +47,14 @@ const AppHeader = () => {
</TooltipMenuIcon>
)}
<AccountSwitcher account={activeAccount!} />
<Button className='mr-6' onClick={logout} size='md'>
<Button
className='mr-6'
onClick={async () => {
await logout();
redirectToOauth();
}}
size='md'
>
<Text size='sm' weight='bold'>
{localize('Logout')}
</Text>
Expand Down
4 changes: 3 additions & 1 deletion src/components/AppHeader/MobileMenu/MobileMenuConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,9 @@ export const MobileMenuConfig = () => {
as: 'button',
label: localize('Log out'),
LeftComponent: LegacyLogout1pxIcon,
onClick: logout,
onClick: async () => {
await logout();
},
removeBorderBottom: true,
},
],
Expand Down

0 comments on commit 00404fc

Please sign in to comment.