Skip to content

Commit

Permalink
Merge pull request #40 from dandanthedev/dev
Browse files Browse the repository at this point in the history
return token after generating
  • Loading branch information
dandanthedev authored Aug 12, 2024
2 parents 963c9c1 + 96f41b4 commit a3529cd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/api/generateToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ export default async function handle(
if (type && ["upload", "download", "delete", "rename"].indexOf(type) === -1)
return resp(res, 400, "Invalid type");

if(downloadAs && type && type !== "download") return resp(res, 400, "Downloadas can only be used on a download type")
if (downloadAs && type && type !== "download")
return resp(res, 400, "Downloadas can only be used on a download type");

const token = await generateSignedToken(bucket, file, type, expiresIn, downloadAs);
const token = await generateSignedToken(
bucket,
file,
type,
expiresIn,
downloadAs
);
if (!token) return resp(res, 400, "Error generating token");

resp(res, 200, token);
return resp(res, 200, token);
}

0 comments on commit a3529cd

Please sign in to comment.