Building the viewer data inside routes

This commit is contained in:
Bruno Alves de Faria committed 2017-03-21 10:16:47 -03:00
1 parent 7718d31a77
commit 9ccebb76bd
9 files changed
+193 -94

No files matched your search

@@ -0,0 +1,26 @@
import { OHIF } from 'meteor/ohif:core';
/**
* Render the viewer with the given routing context and parameters
*
* @param {Context} context Context of the router
* @param {Object} params Parameters that will be used to prepare the viewer data
*/
export const renderViewer = (context, params) => {
// Wait until the viewer data is ready to render it
const promise = OHIF.viewerbase.prepareViewerData(params);
// Show loading state while preparing the viewer data
OHIF.ui.showDialog('dialogLoading', { promise });
// Render the viewer when the data is ready
promise.then(({ studies, viewerData }) => {
context.render('app', {
data: {
template: 'viewer',
studies,
viewerData
}
});
});
};