Compare commits
2 commits
059bbe956a
...
78457a7d27
| Author | SHA1 | Date | |
|---|---|---|---|
| 78457a7d27 | |||
| 31ed78e863 |
2 changed files with 17 additions and 0 deletions
|
|
@ -791,6 +791,9 @@ export function useConnections() {
|
||||||
knowledgePreferences?: import('../api/connectionApi').KnowledgePreferences | null,
|
knowledgePreferences?: import('../api/connectionApi').KnowledgePreferences | null,
|
||||||
): Promise<void> => {
|
): Promise<void> => {
|
||||||
if (isConnecting) return;
|
if (isConnecting) return;
|
||||||
|
if (type === 'infomaniak') {
|
||||||
|
throw new Error('Infomaniak uses PAT flow – use createInfomaniakConnection + submitInfomaniakToken instead.');
|
||||||
|
}
|
||||||
setIsConnecting(true);
|
setIsConnecting(true);
|
||||||
try {
|
try {
|
||||||
const newConnection = await createConnection({
|
const newConnection = await createConnection({
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,8 @@ export const ConnectionsPage: React.FC = () => {
|
||||||
connectWithPopup,
|
connectWithPopup,
|
||||||
refreshMicrosoftToken,
|
refreshMicrosoftToken,
|
||||||
refreshGoogleToken,
|
refreshGoogleToken,
|
||||||
|
createInfomaniakConnection,
|
||||||
|
submitInfomaniakToken,
|
||||||
isConnecting,
|
isConnecting,
|
||||||
} = useConnections();
|
} = 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 handleMsftAdminConsent = () => {
|
||||||
const url = `${getApiBaseUrl()}/api/msft/adminconsent`;
|
const url = `${getApiBaseUrl()}/api/msft/adminconsent`;
|
||||||
window.open(url, 'msft-admin-consent', 'width=560,height=720,scrollbars=yes,resizable=yes');
|
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}
|
open={wizardOpen}
|
||||||
onClose={() => setWizardOpen(false)}
|
onClose={() => setWizardOpen(false)}
|
||||||
onConnect={handleWizardConnect}
|
onConnect={handleWizardConnect}
|
||||||
|
onInfomaniakConnect={handleInfomaniakConnect}
|
||||||
onMsftAdminConsent={handleMsftAdminConsent}
|
onMsftAdminConsent={handleMsftAdminConsent}
|
||||||
isConnecting={isConnecting}
|
isConnecting={isConnecting}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue