fix: clean code to account for guaranteed array returns
This commit is contained in:
parent
100d5e80eb
commit
cbe50dd028
1 changed files with 2 additions and 2 deletions
|
@ -5,10 +5,10 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||||
|
|
||||||
const guildId = to.params.serverId as string;
|
const guildId = to.params.serverId as string;
|
||||||
|
|
||||||
const channels: ChannelResponse[] | undefined = await fetchChannels(guildId);
|
const channels: ChannelResponse[] = await fetchChannels(guildId);
|
||||||
console.log("channels:", channels);
|
console.log("channels:", channels);
|
||||||
|
|
||||||
if (channels && channels.length > 0) {
|
if (channels.length > 0) {
|
||||||
console.log("wah");
|
console.log("wah");
|
||||||
return await navigateTo(`/servers/${guildId}/channels/${channels[0].uuid}`, { replace: true });
|
return await navigateTo(`/servers/${guildId}/channels/${channels[0].uuid}`, { replace: true });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue