This commit is contained in:
parent
7929cd8cf8
commit
4aa89b66da
6
index.ts
6
index.ts
@ -24,7 +24,7 @@ const signer = async function (asset: string) {
|
|||||||
return await presigner.presign(new HttpRequest(s3ObjectUrl));
|
return await presigner.presign(new HttpRequest(s3ObjectUrl));
|
||||||
}
|
}
|
||||||
|
|
||||||
const getPromises = async function (resp: object, path: string): Promise<any> {
|
const getScreenshots = async function (resp: object, path: string): Promise<any> {
|
||||||
const screenshots = resp.screenshots ? resp.screenshots : []
|
const screenshots = resp.screenshots ? resp.screenshots : []
|
||||||
if (path === '/details/') {
|
if (path === '/details/') {
|
||||||
return screenshots.map(async (x) => {
|
return screenshots.map(async (x) => {
|
||||||
@ -47,8 +47,8 @@ export default {
|
|||||||
async fetch(request: Request) {
|
async fetch(request: Request) {
|
||||||
let reqUrl = await parseUrl(request.url)
|
let reqUrl = await parseUrl(request.url)
|
||||||
let req = await request.json();
|
let req = await request.json();
|
||||||
|
let promises = getScreenshots(req, reqUrl.path)
|
||||||
return Promise.all(await getPromises(req, reqUrl.path)).then((r) => {
|
return Promise.all(promises).then((r) => {
|
||||||
let resp = Object.assign({}, req)
|
let resp = Object.assign({}, req)
|
||||||
resp.screenshots = r
|
resp.screenshots = r
|
||||||
return resp
|
return resp
|
||||||
|
Loading…
Reference in New Issue
Block a user