diff --git a/src/components/SignInButton.tsx b/src/components/SignInButton.tsx index 8e762a8a8..faede9293 100644 --- a/src/components/SignInButton.tsx +++ b/src/components/SignInButton.tsx @@ -109,9 +109,10 @@ export const SignInButton = (props: SignInButtonProps) => { const syncSignInOrRegistrationEvent = async (event: String) => { Storage.setAnonymousId(); - await Metrics.identify(Storage.getAnonymousId()); - await Metrics.syncProfile(); - await Metrics.captureEvent(event); + Metrics.identify(Storage.getAnonymousId()).then(() => { + Metrics.syncProfile(); + Metrics.captureEvent(event); + }); }; const errorStreamToString = async (error: HttpError) => { diff --git a/src/libs/ajax/DAR.js b/src/libs/ajax/DAR.js index 274257bdb..4c65c0cf6 100644 --- a/src/libs/ajax/DAR.js +++ b/src/libs/ajax/DAR.js @@ -19,7 +19,8 @@ export const DAR = { //v2, v3 Draft DAR Update updateDarDraft: async (dar, referenceId) => { - await Metrics.captureEvent(eventList.dar, {'action': 'update'}); + // noinspection ES6MissingAwait + Metrics.captureEvent(eventList.dar, {'action': 'update'}); const url = DAAUtils.isEnabled() ? `${await getApiUrl()}/api/dar/v3/draft/${referenceId}` : `${await getApiUrl()}/api/dar/v2/draft/${referenceId}`; @@ -29,7 +30,8 @@ export const DAR = { //v2, v3 Draft DAR Creation postDarDraft: async (dar) => { - await Metrics.captureEvent(eventList.dar, {'action': 'draft'}); + // noinspection ES6MissingAwait + Metrics.captureEvent(eventList.dar, {'action': 'draft'}); const url = DAAUtils.isEnabled() ? `${await getApiUrl()}/api/dar/v3/draft` : `${await getApiUrl()}/api/dar/v2/draft`; @@ -46,7 +48,8 @@ export const DAR = { //v2, v3 DAR Creation postDar: async (dar) => { - await Metrics.captureEvent(eventList.dar, {'action': 'submit'}); + // noinspection ES6MissingAwait + Metrics.captureEvent(eventList.dar, {'action': 'submit'}); const filteredDar = fp.omit(['createDate', 'sortDate', 'data_access_request_id'])(dar); const url = DAAUtils.isEnabled() ? `${await getApiUrl()}/api/dar/v3` : diff --git a/src/pages/DatasetSearch.jsx b/src/pages/DatasetSearch.jsx index df86eeee6..f5cd1073a 100644 --- a/src/pages/DatasetSearch.jsx +++ b/src/pages/DatasetSearch.jsx @@ -275,9 +275,10 @@ export const DatasetSearch = (props) => { useEffect(() => { const init = async () => { + // noinspection ES6MissingAwait key === '/datalibrary' ? - await Metrics.captureEvent(eventList.dataLibrary) : - await Metrics.captureEvent(eventList.dataLibrary, {'brand': key.replaceAll('/', '').toLowerCase()}); + Metrics.captureEvent(eventList.dataLibrary) : + Metrics.captureEvent(eventList.dataLibrary, {'brand': key.replaceAll('/', '').toLowerCase()}); }; init(); }, [key]); diff --git a/src/pages/dar_application/DataAccessRequestApplication.jsx b/src/pages/dar_application/DataAccessRequestApplication.jsx index 1ac2d01e3..f88f360dd 100644 --- a/src/pages/dar_application/DataAccessRequestApplication.jsx +++ b/src/pages/dar_application/DataAccessRequestApplication.jsx @@ -375,7 +375,8 @@ const DataAccessRequestApplication = (props) => { if (isInvalidForm) { scrollToFormErrors(validation, eraCommonsIdValid, hasLibraryCard); } else { - await Metrics.captureEvent(eventList.dar, {'action': 'attest'}); + // noinspection ES6MissingAwait + Metrics.captureEvent(eventList.dar, {'action': 'attest'}); setIsAttested(true); addDucAddendumTab(); await goToDucAddendum();