diff --git a/index.html b/index.html
index 211b5c8..9689f60 100644
--- a/index.html
+++ b/index.html
@@ -552,13 +552,7 @@
Wahyu & Riski
-
diff --git a/js/offline.js b/js/offline.js
index c8b8a35..4ab1dcd 100644
--- a/js/offline.js
+++ b/js/offline.js
@@ -2,7 +2,6 @@ export const offline = (() => {
let alert = null;
let online = true;
- let abort = [];
const show = (isUp = true) => new Promise((res) => {
let op = parseFloat(alert.style.opacity);
@@ -87,7 +86,6 @@ export const offline = (() => {
setOffline();
show();
changeState();
- abort.forEach((a) => a());
};
const onOnline = () => {
@@ -100,14 +98,19 @@ export const offline = (() => {
const isOnline = () => online;
- const addAbort = (callback) => {
- abort.push(callback);
- };
-
const init = () => {
window.addEventListener('online', onOnline);
window.addEventListener('offline', onOffline);
alert = document.getElementById('offline-mode');
+
+ if (alert.childElementCount === 0) {
+ alert.innerHTML = `
+
`;
+ }
};
return {
diff --git a/js/request.js b/js/request.js
index 69de110..79698a1 100644
--- a/js/request.js
+++ b/js/request.js
@@ -1,5 +1,4 @@
import { dto } from './dto.js';
-import { offline } from './offline.js';
import { session } from './session.js';
export const HTTP_GET = 'GET';
@@ -10,19 +9,13 @@ export const HTTP_DELETE = 'DELETE';
export const request = (method, path) => {
- const controller = new AbortController();
- const header = new Headers({
- 'Accept': 'application/json',
- 'Content-Type': 'application/json'
- });
-
- offline.addAbort(() => controller.abort());
-
let url = document.body.getAttribute('data-url');
let req = {
method: String(method).toUpperCase(),
- headers: header,
- signal: controller.signal,
+ headers: new Headers({
+ 'Accept': 'application/json',
+ 'Content-Type': 'application/json'
+ }),
};
if (url.slice(-1) === '/') {