| ... |
... |
@@ -10,14 +10,12 @@ |
| 10 |
10 |
|
| 11 |
11 |
self.addEventListener("fetch" , event => { |
| 12 |
12 |
const pathname = new URL(event.request.url).pathname; |
| 13 |
|
- if(pathname === '/getMembershipRequets') { |
| 14 |
|
- return new Response('should return membership requests'); |
| 15 |
|
- /* |
| 16 |
|
- event.respondWith(fetch(event.request).then(res => res.json()).then(json => { |
|
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 => { |
| 17 |
17 |
const headers = new Headers({'Content-Type': 'application/json'}); |
| 18 |
18 |
const jsonResults = json.rows.filter(row => row.doc_viewable === true); |
| 19 |
19 |
return new Response(JSON.stringify(jsonResults), {headers}); |
| 20 |
20 |
})); |
| 21 |
|
- */ |
| 22 |
22 |
} |
| 23 |
23 |
}); |