v0.12.0 codes for FCM and rebranded jama to RosterChirp
This commit is contained in:
@@ -36,7 +36,7 @@ async function req(method, path, body, opts = {}) {
|
||||
if (res.status === 401 && data.error?.includes('Session expired')) {
|
||||
localStorage.removeItem('tc_token');
|
||||
sessionStorage.removeItem('tc_token');
|
||||
window.dispatchEvent(new CustomEvent('jama:session-displaced'));
|
||||
window.dispatchEvent(new CustomEvent('rosterchirp:session-displaced'));
|
||||
}
|
||||
throw new Error(data.error || 'Request failed');
|
||||
}
|
||||
@@ -123,7 +123,7 @@ export const api = {
|
||||
bulkAvailability: (responses) => req('POST', '/schedule/me/bulk-availability', { responses }),
|
||||
importPreview: (file) => {
|
||||
const fd = new FormData(); fd.append('file', file);
|
||||
return fetch('/api/schedule/import/preview', { method: 'POST', headers: { Authorization: 'Bearer ' + localStorage.getItem('jama-token') }, body: fd }).then(r => r.json());
|
||||
return fetch('/api/schedule/import/preview', { method: 'POST', headers: { Authorization: 'Bearer ' + localStorage.getItem('tc_token') }, body: fd }).then(r => r.json());
|
||||
},
|
||||
importConfirm: (rows) => req('POST', '/schedule/import/confirm', { rows }),
|
||||
|
||||
@@ -166,16 +166,11 @@ export const api = {
|
||||
},
|
||||
resetSettings: () => req('POST', '/settings/reset'),
|
||||
|
||||
// Push notifications
|
||||
getPushKey: () => req('GET', '/push/vapid-public'),
|
||||
subscribePush: (sub) => req('POST', '/push/subscribe', sub),
|
||||
unsubscribePush: (endpoint) => req('POST', '/push/unsubscribe', { endpoint }),
|
||||
// Push notifications (FCM)
|
||||
getFirebaseConfig: () => req('GET', '/push/firebase-config'),
|
||||
subscribePush: (fcmToken) => req('POST', '/push/subscribe', { fcmToken }),
|
||||
unsubscribePush: () => req('POST', '/push/unsubscribe'),
|
||||
|
||||
// Link preview
|
||||
getLinkPreview: (url) => req('GET', `/link-preview?url=${encodeURIComponent(url)}`),
|
||||
|
||||
|
||||
|
||||
// VAPID key management (admin only)
|
||||
generateVapidKeys: () => req('POST', '/push/generate-vapid'),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user