feat: add loading on client layout

This commit is contained in:
SauceyRed 2025-05-29 02:36:10 +02:00
parent a324cc9300
commit 3b1581d950
Signed by: sauceyred
GPG key ID: 270B096EF6E9A462
2 changed files with 37 additions and 11 deletions

View file

@ -39,25 +39,20 @@
const route = useRoute();
const server: GuildResponse | undefined = await fetchWithApi(`servers/${route.params.serverId}`);
const channels: ChannelResponse[] | undefined = await fetchWithApi(
`servers/${route.params.serverId}/channels`
);
const channel: ChannelResponse | undefined = await fetchWithApi(
route.path
);
const loading = useState("loading");
const channelUrlPath = `servers/${route.params.serverId}/channels/${route.params.channelId}`;
console.log("channel:", channel);
const server = ref<GuildResponse | undefined>();
const channels = ref<ChannelResponse[] | undefined>();
const channel = ref<ChannelResponse | undefined>();
const showInvitePopup = ref(false);
import type { ChannelResponse, GuildResponse, MessageResponse } from "~/types/interfaces";
//const servers = await fetchWithApi("/servers") as { uuid: string, name: string, description: string }[];
//console.log("servers:", servers);
//console.log("channelid: servers:", servers);
const members = [
{
id: "3287484395",
@ -106,6 +101,24 @@ const members = [
}
];
onMounted(async () => {
loading.value = true;
console.log("channelid: set loading to true");
server.value = await fetchWithApi(`servers/${route.params.serverId}`);
channels.value = await fetchWithApi(
`servers/${route.params.serverId}/channels`
);
channel.value = await fetchWithApi(
route.path
);
console.log("channelid: channel:", channel);
await sleep(3000);
loading.value = false;
console.log("channelid: set loading to false");
});
function showServerSettings() { }
function toggleInvitePopup(e: Event) {