Skip to content

Commit 91d9e86

Browse files
authored
yashim/fix: logout (#230)
1 parent 6cea6b9 commit 91d9e86

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

package-lock.json

+5-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"@babel/preset-env": "^7.24.5",
1919
"@chakra-ui/react": "^2.8.2",
2020
"@deriv-com/analytics": "^1.10.1",
21-
"@deriv-com/api-hooks": "^1.4.5",
21+
"@deriv-com/api-hooks": "^1.4.7",
2222
"@deriv-com/translations": "^1.2.4",
2323
"@deriv-com/ui": "^1.29.0",
2424
"@deriv-com/utils": "^0.0.28",

src/components/AppHeader/AppHeader.tsx

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { getOauthUrl } from '@/constants';
2-
import { api } from '@/hooks';
2+
import { api, useRedirectToOauth } from '@/hooks';
33
import { getCurrentRoute } from '@/utils';
44
import { StandaloneCircleUserRegularIcon } from '@deriv/quill-icons';
55
import { useAuthData } from '@deriv-com/api-hooks';
@@ -19,6 +19,7 @@ import './AppHeader.scss';
1919
const AppHeader = () => {
2020
const { isDesktop } = useDevice();
2121
const isEndpointPage = getCurrentRoute() === 'endpoint';
22+
const { redirectToOauth } = useRedirectToOauth();
2223
const { activeLoginid, logout } = useAuthData();
2324
const { data: activeAccount } = api.account.useActiveAccount();
2425
const { localize } = useTranslations();
@@ -46,7 +47,14 @@ const AppHeader = () => {
4647
</TooltipMenuIcon>
4748
)}
4849
<AccountSwitcher account={activeAccount!} />
49-
<Button className='mr-6' onClick={logout} size='md'>
50+
<Button
51+
className='mr-6'
52+
onClick={async () => {
53+
await logout();
54+
redirectToOauth();
55+
}}
56+
size='md'
57+
>
5058
<Text size='sm' weight='bold'>
5159
{localize('Logout')}
5260
</Text>

src/components/AppHeader/MobileMenu/MobileMenuConfig.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ export const MobileMenuConfig = () => {
118118
as: 'button',
119119
label: localize('Log out'),
120120
LeftComponent: LegacyLogout1pxIcon,
121-
onClick: logout,
121+
onClick: async () => {
122+
await logout();
123+
},
122124
removeBorderBottom: true,
123125
},
124126
],

0 commit comments

Comments
 (0)