1
I am starting to study Javascript and am developing a web application, in which an NGO register and can create cases. I’m using Insomnia to test HTTP requests. However, when trying to delete a case, Insomnia loads the request and has no return, and in the VS Code terminal, I have the following message:
(node:9328) UnhandledPromiseRejectionWarning: ReferenceError: ong is not defined
    at delete (C:\Semana OmniStack\www\semanaomnistack11\aulas\backend\src\controllers\IncidentController.js:50:31)
(node:9328) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an 
async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:9328) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.*
PS: all other requests work except this one. The delete method is as follows::
 async delete(request, response) {
     const { id } = request.params;
     const ong_id = request.headers.authorization;
     const incident = await connection('incidents')
         .where('id', id)
         .select('ong_id')
         .first();
     if (incident.ong_id != ong.id) {
         return response.status(401).json({ error: 'Operation not permitted.' });
     }
     await connection('incidents').where('id', id).delete();
     return response.status(204).send();
}
Would instead of
ong.idyou should haveong_idhereif (incident.ong_id != ong.id) {?– Sergio