Skip to content

Commit

Permalink
а
Browse files Browse the repository at this point in the history
  • Loading branch information
talafarael committed Mar 20, 2024
1 parent da57b8b commit 1c0645b
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/Router/authLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ const generateAccessToken = (id) => {
}
return jwt.sign(playold, secret, {expiresIn: "24h"})
}
const fs = require("fs")
const util = require("util")
const unlinkFile = util.promisify(fs.unlink)

// const storage = new Storage({
// projectId,
// keyFilename,
Expand All @@ -32,13 +30,11 @@ const unlinkFile = util.promisify(fs.unlink)
class authController {
async editprofileimage(req, res) {
try {
const file = req.file
const result = await uploadFile(file)
await unlinkFile(file.path)

const files = req.file.path
const path = files.split("\\")
const fileName = `https://faralaer.s3.eu-west-2.amazonaws.com/${path[1]}`
await uploadFile(req.file);

const fileName = `https://faralaer.s3.eu-west-2.amazonaws.com/${req.file.originalname}`

const {user, id} = await verifyToken(token, res)
user.img = fileName

Expand Down

0 comments on commit 1c0645b

Please sign in to comment.