refactor: do not await assertRequestType

it's not an async function, lmao
This commit is contained in:
Bobby 2022-07-22 08:50:26 +07:00
parent 951737d7d0
commit 4ca64b141f
No known key found for this signature in database
GPG Key ID: 941839794CBF5A09
4 changed files with 17 additions and 17 deletions

View File

@ -189,7 +189,7 @@ self.list = async (req, res) => {
}
self.create = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body
@ -234,7 +234,7 @@ self.create = async (req, res) => {
}
self.delete = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body and re-map for .disable()
req.body = await req.json()
@ -247,7 +247,7 @@ self.delete = async (req, res) => {
}
self.disable = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
const ismoderator = perms.is(user, 'moderator')
@ -321,7 +321,7 @@ self.disable = async (req, res) => {
}
self.edit = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
const ismoderator = perms.is(user, 'moderator')
@ -424,7 +424,7 @@ self.edit = async (req, res) => {
}
self.rename = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body and re-map for .edit()
req.body = await req.json()
@ -636,7 +636,7 @@ self.generateZip = async (req, res) => {
}
self.addFiles = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body

View File

@ -31,7 +31,7 @@ const self = {
const saltRounds = 10
self.verify = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body
req.body = await req.json()
@ -65,7 +65,7 @@ self.verify = async (req, res) => {
}
self.register = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body
req.body = await req.json()
@ -117,7 +117,7 @@ self.register = async (req, res) => {
}
self.changePassword = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body
@ -150,7 +150,7 @@ self.assertPermission = (user, target) => {
}
self.createUser = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body
@ -216,7 +216,7 @@ self.createUser = async (req, res) => {
}
self.editUser = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body, if required
@ -273,7 +273,7 @@ self.editUser = async (req, res) => {
}
self.disableUser = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body and re-map for .editUser()
req.body = await req.json()
@ -288,7 +288,7 @@ self.disableUser = async (req, res) => {
}
self.deleteUser = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body

View File

@ -34,7 +34,7 @@ self.generateUniqueToken = async () => {
}
self.verify = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body
req.body = await req.json()

View File

@ -625,7 +625,7 @@ self.actuallyUploadUrls = async (req, res, user, data = {}) => {
/** Chunk uploads */
self.finishChunks = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
if (!chunkedUploads) {
throw new ClientError('Chunked upload is disabled.', { statusCode: 403 })
@ -1049,7 +1049,7 @@ self.sendUploadResponse = async (req, res, user, result) => {
/** Delete uploads */
self.delete = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
// Parse POST body and re-map for .bulkDelete()
// Original API used by lolisafe v3's frontend
@ -1067,7 +1067,7 @@ self.delete = async (req, res) => {
}
self.bulkDelete = async (req, res) => {
await utils.assertRequestType(req, 'json')
utils.assertRequestType(req, 'json')
const user = await utils.authorize(req)
// Parse POST body, if required