Remove rogue JSON.parse

This commit is contained in:
Khushraj Rathod 2020-10-31 10:06:37 +05:30
parent 3103294d0e
commit 1a9e592326
No known key found for this signature in database
GPG key ID: B77B2A40E7702F19
3 changed files with 4 additions and 4 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
.env
.vercel
.vercel
.vscode

View file

@ -61,13 +61,13 @@ export default async (req: ServerRequest) => {
const { pathname } = urlParse(url)
const filename = index + pathname.substr(pathname.lastIndexOf('/') + 1)
const res = JSON.parse(await (await fetch("https://cdn.hackclub.com/api/newSingle", {
const res = await (await fetch("https://cdn.hackclub.com/api/newSingle", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: url
})).json())
})).json()
res.file = 'public/' + filename
res.path = filename

View file

@ -1,6 +1,5 @@
import { ServerRequest } from 'https://deno.land/std@0.75.0/http/server.ts'
import { Hash } from "https://deno.land/x/checksum@1.4.0/mod.ts"
import { urlParse } from 'https://deno.land/x/url_parse/mod.ts';
const endpoint = (path: string) => {
// https://vercel.com/docs/api#api-basics/authentication/accessing-resources-owned-by-a-team