Integration TrizRis OHIF: key images, annotations, layouts, access control and reconstruction
Build and Deploy Docs / build-and-deploy-docs (push) Canceled after 0s
Build and Deploy Docs / build-and-deploy-docs (push) Canceled after 0s
This commit is contained in:
1 parent
bbe37ff388
commit
f00379a672
28 files changed
+1898
-105
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import { TrizRisConfig } from '@ohif/core/src/config/TrizRisConfig';
|
||||
const BASE_URL = `${TrizRisConfig.apiBaseUrl}/layout/current`;
|
||||
|
||||
export type SavedLayout = {
|
||||
numRows: number;
|
||||
numCols: number;
|
||||
};
|
||||
|
||||
export async function saveLayoutPreference(
|
||||
numRows: number,
|
||||
numCols: number,
|
||||
studyInstanceUID: string
|
||||
): Promise<void> {
|
||||
const response = await fetch(BASE_URL, {
|
||||
method: 'POST',
|
||||
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Accept: 'application/json',
|
||||
},
|
||||
|
||||
credentials: 'include',
|
||||
|
||||
body: JSON.stringify({
|
||||
numRows,
|
||||
numCols,
|
||||
studyInstanceUID,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur sauvegarde layout TrizRis : ${response.status}`);
|
||||
}
|
||||
}
|
||||
|
||||
export async function getLayoutPreference(studyInstanceUID: string): Promise<SavedLayout | null> {
|
||||
const response = await fetch(
|
||||
`${BASE_URL}?studyInstanceUID=${encodeURIComponent(studyInstanceUID)}`,
|
||||
{
|
||||
method: 'GET',
|
||||
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
|
||||
credentials: 'include',
|
||||
}
|
||||
);
|
||||
|
||||
if (response.status === 204) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Erreur récupération layout TrizRis : ${response.status}`);
|
||||
}
|
||||
|
||||
return response.json();
|
||||
}
|
||||
Reference in new issue
Block a user