mirror of
https://github.com/mollersuite/monofile.git
synced 2024-11-25 23:16:27 -08:00
weed smoker charlie
This commit is contained in:
parent
dbe927f367
commit
0405f89542
|
@ -142,9 +142,8 @@ module.exports = function(files: Files) {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
router.delete("/me/:deleteFiles",
|
router.delete("/me",
|
||||||
requiresAccount,
|
requiresAccount, noAPIAccess,
|
||||||
noAPIAccess,
|
|
||||||
parser,
|
parser,
|
||||||
(req, res) => {
|
(req, res) => {
|
||||||
const Account = res.locals.acc as Accounts.Account
|
const Account = res.locals.acc as Accounts.Account
|
||||||
|
@ -155,20 +154,7 @@ module.exports = function(files: Files) {
|
||||||
Authentication.invalidate(token.token)
|
Authentication.invalidate(token.token)
|
||||||
})
|
})
|
||||||
|
|
||||||
const deleteAccount = () => Accounts.deleteAccount(accountId).then(_ => res.send("account deleted"))
|
Accounts.deleteAccount(accountId).then(_ => res.send("account deleted"))
|
||||||
|
|
||||||
if (req.params.deleteFiles) {
|
|
||||||
const Files = Account.files.map(e => e)
|
|
||||||
|
|
||||||
for (let fileId of Files) {
|
|
||||||
files.unlink(fileId, true).catch(err => console.error)
|
|
||||||
}
|
|
||||||
|
|
||||||
writeFile(process.cwd() + "/.data/files.json", JSON.stringify(files.files), (err) => {
|
|
||||||
if (err) console.log(err)
|
|
||||||
deleteAccount()
|
|
||||||
})
|
|
||||||
} else deleteAccount()
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue