fix: clean code to account for guaranteed array returns

This commit is contained in:
Twig 2025-07-16 10:47:50 +02:00
parent 100d5e80eb
commit cbe50dd028
No known key found for this signature in database

View file

@ -5,10 +5,10 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
const guildId = to.params.serverId as string;
const channels: ChannelResponse[] | undefined = await fetchChannels(guildId);
const channels: ChannelResponse[] = await fetchChannels(guildId);
console.log("channels:", channels);
if (channels && channels.length > 0) {
if (channels.length > 0) {
console.log("wah");
return await navigateTo(`/servers/${guildId}/channels/${channels[0].uuid}`, { replace: true });
}