Skip to content
Snippets Groups Projects
Commit 1c3002b6 authored by paflov's avatar paflov
Browse files

restores the version of notifyDyingTest with employs the specialized endpoint...

restores the version of notifyDyingTest with employs the specialized endpoint and the fetch-api als alternative to sendBeacon. It was appareantly lost my merging with master.
parent d417d548
No related branches found
No related tags found
No related merge requests found
......@@ -110,11 +110,13 @@ export class BackendService {
}
notifyDyingTest(testId: string): void {
// TODO add auth or change end point
if (navigator.sendBeacon) {
navigator.sendBeacon(`${this.serverUrl}test/${testId}/state`, JSON.stringify(<StateReportEntry>{
key: TestStateKey.FOCUS, timeStamp: Date.now(), content: AppFocusState.DEAD
}));
navigator.sendBeacon(this.serverUrl + `test/${testId}/connection-lost`);
} else {
fetch(this.serverUrl + `test/${testId}/connection-lost`, {
keepalive: true,
method: 'POST'
});
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment