30 lines
624 B
TypeScript
30 lines
624 B
TypeScript
import { TrizRisConfig } from '@ohif/core/src/config/TrizRisConfig';
|
|
|
|
const ACCESS_URL = `${TrizRisConfig.apiBaseUrl}/ohif/access`;
|
|
|
|
export async function checkTrizRisAccess(): Promise<boolean> {
|
|
try {
|
|
const response = await fetch(ACCESS_URL, {
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
Accept: 'application/json',
|
|
},
|
|
|
|
credentials: 'include',
|
|
});
|
|
|
|
if (!response.ok) {
|
|
return false;
|
|
}
|
|
|
|
const result = await response.json();
|
|
|
|
return result.authorized === true;
|
|
} catch (error) {
|
|
console.error('### ERREUR VERIFICATION ACCES TRIZRIS ###', error);
|
|
|
|
return false;
|
|
}
|
|
}
|