fix infomaniak
This commit is contained in:
parent
4475a45a26
commit
31ed78e863
2 changed files with 17 additions and 0 deletions
|
|
@ -791,6 +791,9 @@ export function useConnections() {
|
|||
knowledgePreferences?: import('../api/connectionApi').KnowledgePreferences | null,
|
||||
): Promise<void> => {
|
||||
if (isConnecting) return;
|
||||
if (type === 'infomaniak') {
|
||||
throw new Error('Infomaniak uses PAT flow – use createInfomaniakConnection + submitInfomaniakToken instead.');
|
||||
}
|
||||
setIsConnecting(true);
|
||||
try {
|
||||
const newConnection = await createConnection({
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ export const ConnectionsPage: React.FC = () => {
|
|||
connectWithPopup,
|
||||
refreshMicrosoftToken,
|
||||
refreshGoogleToken,
|
||||
createInfomaniakConnection,
|
||||
submitInfomaniakToken,
|
||||
isConnecting,
|
||||
} = useConnections();
|
||||
|
||||
|
|
@ -234,6 +236,17 @@ export const ConnectionsPage: React.FC = () => {
|
|||
}
|
||||
};
|
||||
|
||||
const handleInfomaniakConnect = async (token: string, knowledgeEnabled: boolean) => {
|
||||
try {
|
||||
const newConn = await createInfomaniakConnection();
|
||||
await submitInfomaniakToken(newConn.id, token);
|
||||
refetch();
|
||||
if (knowledgeEnabled) showSyncBanner('Infomaniak');
|
||||
} catch (error) {
|
||||
console.error('Error creating Infomaniak connection:', error);
|
||||
}
|
||||
};
|
||||
|
||||
const handleMsftAdminConsent = () => {
|
||||
const url = `${getApiBaseUrl()}/api/msft/adminconsent`;
|
||||
window.open(url, 'msft-admin-consent', 'width=560,height=720,scrollbars=yes,resizable=yes');
|
||||
|
|
@ -469,6 +482,7 @@ export const ConnectionsPage: React.FC = () => {
|
|||
open={wizardOpen}
|
||||
onClose={() => setWizardOpen(false)}
|
||||
onConnect={handleWizardConnect}
|
||||
onInfomaniakConnect={handleInfomaniakConnect}
|
||||
onMsftAdminConsent={handleMsftAdminConsent}
|
||||
isConnecting={isConnecting}
|
||||
/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue