alpha-version-dce-check-in-ui
Version:
UI for taking attendance and checking people in.
33 lines (27 loc) • 1.03 kB
text/typescript
// Import helpers
import genOccurrenceId from '../../shared/helpers/genOccurrenceId';
// Import types
import OccurrenceBasicInfo from '../../shared/types/OccurrenceBasicInfo';
import VisitServerEndpoint from '../../types/VisitServerEndpoint';
// Import constants
import TTM_PATH_PREFIX from '../../shared/constants/TTM_PATH_PREFIX';
/**
* Call the backend to check whether the occurrence has already started.
* @author Benedikt Arnarsson
* @param occurrenceBasicInfo information needed to query for the occurrence.
* @returns a boolean indicating whether the occurrence has already been created/started.
*/
const isOccurrenceStarted = async (
visitServerEndpoint: VisitServerEndpoint,
occurrenceBasicInfo: OccurrenceBasicInfo,
): Promise<boolean> => {
const occurrenceId = genOccurrenceId(occurrenceBasicInfo);
const occurrence = await visitServerEndpoint({
path: `${TTM_PATH_PREFIX}/occurrence`,
params: {
occurrenceId,
}
});
return !!occurrence;
};
export default isOccurrenceStarted;