Changes for page LiveTableServiceWorker
Last modified by bougault on 2022/03/22 17:19
Summary
-
Objects (1 modified, 0 added, 0 removed)
Details
- XWiki.JavaScriptExtension[0]
-
- Code
-
... ... @@ -5,17 +5,17 @@ 5 5 }); 6 6 7 7 self.addEventListener("activate" , event => { 8 - event.waitUntil(self.clients.claim()); 8 +// console.log(event); 9 + clients.claim(); 10 +// event.waitUntil(clients.claim()); 9 9 }); 10 10 11 11 self.addEventListener("fetch" , event => { 12 12 const pathname = new URL(event.request.url).pathname; 13 - if(pathname === '/getMembershipRequests') { 14 - const req = fetch('/bin/get/XWiki/LiveTableResults?outputSyntax=plain&transprefix=membershiprequest.livetable.&classname=Collaboratory.Apps.Membership.MembershipRequest.Code.MembershipRequestClass&collist=doc.title%2Ctarget%2Cusername%2Cstatus%2Cdoc.date&queryFilters=currentlanguage%2Chidden&offset=1&limit=15&reqNo=1&sort=doc.date&dir=desc'); 15 - event.respondWith(req.then(res => res.json()).then(json => { 16 - const headers = new Headers({'Content-Type': 'application/json'}); 17 - const jsonResults = json.rows.filter(row => row.doc_viewable === true); 18 - return new Response(JSON.stringify(jsonResults), {headers}); 15 + if(pathname === '/bin/get/XWiki/LiveTableResults') { 16 + //const res = fetch(event.request).then(res => res.json()).then(json => json["rows"].filter(row => row.doc_viewable === true)); 17 + event.respondWith(fetch(event.request).then(res => res.json()).then(json => { 18 + return new Response("xaxa"); 19 19 })); 20 20 } 21 21 });