Remove payments API routing initialization
[ProtonMail-WebClient.git] / packages / components / containers / desktop / useRedirectToAccountApp.ts
blob4ec3f795009fccb1488d011a5657fd5a7f23104e
1 import { useCallback } from 'react';
3 import { getAppHref } from '@proton/shared/lib/apps/helper';
4 import { APPS } from '@proton/shared/lib/constants';
5 import { isElectronApp } from '@proton/shared/lib/helpers/desktop';
7 import { openLinkInBrowser } from './openExternalLink';
8 import { useHasInboxDesktopInAppPayments } from './useHasInboxDesktopInAppPayments';
10 export function useRedirectToAccountApp() {
11     const hasInboxDesktopInAppPayments = useHasInboxDesktopInAppPayments();
13     return useCallback(() => {
14         if (isElectronApp && !hasInboxDesktopInAppPayments) {
15             openLinkInBrowser(getAppHref('/mail/dashboard', APPS.PROTONACCOUNT));
16             return true;
17         }
19         return false;
20     }, [hasInboxDesktopInAppPayments]);