Error handling

master
masterhc 1 year ago
parent d9d2cee1ab
commit 3a933ef7b0

@ -25,7 +25,7 @@ exports.dashboard = (bot)=>
username:'placeholder', username:'placeholder',
avatar:'', avatar:'',
} }
if(!req.headers.cookie) return res.render('dashboard.ejs', {user:userPlaceholder, guilds:{}}); if(!req.headers.cookie) return res.render('dashboard.ejs', {user:userPlaceholder, guilds:[{}]});
const connector = new DiscordAPI(req.headers.cookie, bot); const connector = new DiscordAPI(req.headers.cookie, bot);
const user = await connector.getUser(); const user = await connector.getUser();
const guilds = await connector.getGuildsFull(); const guilds = await connector.getGuildsFull();

@ -1,5 +1,7 @@
<div id="Guilds" > <div id="Guilds" >
<% guilds.forEach(guild => {%> <% if(guilds.length>0){%>
<%- include('guildCard.ejs', {guild}) %> <% guilds.forEach(guild => {%>
<% }); %> <%- include('guildCard.ejs', {guild}) %>
<% }); %>
<% } %>
</div> </div>
Loading…
Cancel
Save