Add files via upload
This commit is contained in:
1 parent
05bae700ec
commit
c6e2fed82c
7 files changed
+235
-3
No files matched your search
@@ -34,6 +34,14 @@ const API = (() => {
|
||||
});
|
||||
}
|
||||
|
||||
function deleteJson(path, body) {
|
||||
return request(path, {
|
||||
method: 'DELETE',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify(body),
|
||||
});
|
||||
}
|
||||
|
||||
// Baut einen Query-String und lässt dabei undefined/null-Werte weg.
|
||||
function qs(params) {
|
||||
const parts = [];
|
||||
@@ -146,5 +154,22 @@ const API = (() => {
|
||||
getLineDelayStats(line, days = 14) {
|
||||
return request(`/stats/delays/${encodeURIComponent(line)}?${qs({ days })}`);
|
||||
},
|
||||
|
||||
// Web-Push (siehe js/push.js + backend/src/routes/webPush.js)
|
||||
getPushPublicKey() {
|
||||
return request('/webpush/public-key');
|
||||
},
|
||||
subscribePush(subscription, favorites) {
|
||||
return postJson('/webpush/subscribe', { subscription, favorites });
|
||||
},
|
||||
unsubscribePush(endpoint) {
|
||||
return postJson('/webpush/unsubscribe', { endpoint });
|
||||
},
|
||||
setPushTripAlarm(endpoint, alarm) {
|
||||
return postJson('/webpush/trip-alarm', { endpoint, ...alarm });
|
||||
},
|
||||
clearPushTripAlarm(endpoint) {
|
||||
return deleteJson('/webpush/trip-alarm', { endpoint });
|
||||
},
|
||||
};
|
||||
})();
|
||||
Reference in new issue
Block a user