Commit 541ddfa2 authored by Geovanny's avatar Geovanny

Added checkers when there is no rows in the DB

parent bcdaeacd
......@@ -117,7 +117,7 @@ class UnitManager(commands.Cog):
"""Gets all units"""
data = await Api.get('/unit/all')
if data == None:
if(data==None or len(data['units'])==0):
return await ctx.send('No units found')
units_data = []
......
......@@ -38,6 +38,9 @@ router.get('/units', async (context, next) => {
checkUser(context);
try{
const data = await userModel.getUserUnits(context.session.user_id);
if(data.length===1 && data[0].id===null){
throw Error('No Units Found')
}
context.response.body = {units: data};
context.status = 200;
}catch(error){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment