fix useTriggerProviderReconnect (#15620)
This commit is contained in:
+20
-6
@@ -115,7 +115,9 @@ describe('useTriggerProviderReconnect', () => {
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.GOOGLE,
|
||||
undefined,
|
||||
{
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -133,7 +135,9 @@ describe('useTriggerProviderReconnect', () => {
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.MICROSOFT,
|
||||
undefined,
|
||||
{
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -160,7 +164,10 @@ describe('useTriggerProviderReconnect', () => {
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.GOOGLE,
|
||||
options,
|
||||
{
|
||||
...options,
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -186,7 +193,10 @@ describe('useTriggerProviderReconnect', () => {
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.MICROSOFT,
|
||||
options,
|
||||
{
|
||||
...options,
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -205,7 +215,9 @@ describe('useTriggerProviderReconnect', () => {
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.GOOGLE,
|
||||
undefined,
|
||||
{
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
expect(mockNavigate).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -230,7 +242,9 @@ describe('useTriggerProviderReconnect', () => {
|
||||
|
||||
expect(mockTriggerApisOAuth).toHaveBeenCalledWith(
|
||||
ConnectedAccountProvider.GOOGLE,
|
||||
undefined,
|
||||
{
|
||||
redirectLocation: '/settings/accounts',
|
||||
},
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
+5
-1
@@ -1,5 +1,6 @@
|
||||
import { useCallback } from 'react';
|
||||
import { ConnectedAccountProvider, SettingsPath } from 'twenty-shared/types';
|
||||
import { getSettingsPath } from 'twenty-shared/utils';
|
||||
|
||||
import { useTriggerApisOAuth } from '@/settings/accounts/hooks/useTriggerApiOAuth';
|
||||
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
|
||||
@@ -26,7 +27,10 @@ export const useTriggerProviderReconnect = () => {
|
||||
return;
|
||||
}
|
||||
|
||||
await triggerApisOAuth(provider, options);
|
||||
await triggerApisOAuth(provider, {
|
||||
...options,
|
||||
redirectLocation: getSettingsPath(SettingsPath.Accounts),
|
||||
});
|
||||
},
|
||||
[triggerApisOAuth, navigate],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user