diff --git a/components/Channel.vue b/components/Guild/ChannelEntry.vue similarity index 100% rename from components/Channel.vue rename to components/Guild/ChannelEntry.vue diff --git a/components/Me/AddFriend.vue b/components/Me/AddFriend.vue new file mode 100644 index 0000000..49aa112 --- /dev/null +++ b/components/Me/AddFriend.vue @@ -0,0 +1,63 @@ + + + + \ No newline at end of file diff --git a/components/Me/DirectMessagesSidebar.vue b/components/Me/DirectMessagesSidebar.vue new file mode 100644 index 0000000..cfe07fd --- /dev/null +++ b/components/Me/DirectMessagesSidebar.vue @@ -0,0 +1,41 @@ + + + + + \ No newline at end of file diff --git a/components/Me/FriendsList.vue b/components/Me/FriendsList.vue new file mode 100644 index 0000000..44c606f --- /dev/null +++ b/components/Me/FriendsList.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/components/MemberEntry.vue b/components/Member/MemberEntry.vue similarity index 96% rename from components/MemberEntry.vue rename to components/Member/MemberEntry.vue index ed4cd48..1ea4170 100644 --- a/components/MemberEntry.vue +++ b/components/Member/MemberEntry.vue @@ -10,7 +10,6 @@ diff --git a/components/UserPopup.vue b/components/User/UserPopup.vue similarity index 100% rename from components/UserPopup.vue rename to components/User/UserPopup.vue diff --git a/components/UserArea.vue b/components/UserArea.vue deleted file mode 100644 index d922c3f..0000000 --- a/components/UserArea.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - \ No newline at end of file diff --git a/components/Button.vue b/components/UserInterface/Button.vue similarity index 100% rename from components/Button.vue rename to components/UserInterface/Button.vue diff --git a/components/UserInterface/VerticalSpacer.vue b/components/UserInterface/VerticalSpacer.vue new file mode 100644 index 0000000..8ac1bd6 --- /dev/null +++ b/components/UserInterface/VerticalSpacer.vue @@ -0,0 +1,12 @@ + + + diff --git a/composables/api.ts b/composables/api.ts index d2ca7a0..11c2226 100644 --- a/composables/api.ts +++ b/composables/api.ts @@ -1,4 +1,4 @@ -import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse, StatsResponse } from "~/types/interfaces"; +import type { ChannelResponse, GuildMemberResponse, GuildResponse, MessageResponse, StatsResponse, UserResponse } from "~/types/interfaces"; export const useApi = () => { async function fetchGuilds(): Promise { @@ -24,14 +24,26 @@ export const useApi = () => { async function fetchMember(guildId: string, memberId: string): Promise { return await fetchWithApi(`/guilds/${guildId}/members/${memberId}`); } - + async function fetchUsers() { return await fetchWithApi(`/users`); } - + async function fetchUser(userId: string) { return await fetchWithApi(`/users/${userId}`); } + + async function fetchFriends(): Promise { + return await fetchWithApi('/me/friends') + } + + async function addFriend(username: string): Promise { + return await fetchWithApi('/me/friends', { method: "POST", body: { username } }); + } + + async function removeFriend(userId: string): Promise { + return await fetchWithApi(`/me/friends/${userId}`, { method: "DELETE" }); + } async function fetchMessages(channelId: string, options?: { amount?: number, offset?: number }): Promise { return await fetchWithApi(`/channels/${channelId}/messages`, { query: { amount: options?.amount ?? 100, offset: options?.offset ?? 0 } }); @@ -59,6 +71,9 @@ export const useApi = () => { fetchMember, fetchUsers, fetchUser, + fetchFriends, + addFriend, + removeFriend, fetchMessages, fetchMessage, fetchInstanceStats, diff --git a/composables/auth.ts b/composables/auth.ts index ebe27de..e3a2fa2 100644 --- a/composables/auth.ts +++ b/composables/auth.ts @@ -106,7 +106,7 @@ export const useAuth = () => { } return { - accessToken, + clearAuth, register, login, logout, diff --git a/layouts/client.vue b/layouts/client.vue index 966e60a..de1e029 100644 --- a/layouts/client.vue +++ b/layouts/client.vue @@ -10,7 +10,7 @@
- +
diff --git a/pages/index.vue b/pages/index.vue index 41deadf..cb5f57e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -1,23 +1,11 @@ + + \ No newline at end of file diff --git a/pages/me/friends.vue b/pages/me/friends.vue new file mode 100644 index 0000000..a0d0384 --- /dev/null +++ b/pages/me/friends.vue @@ -0,0 +1,56 @@ + + + + + \ No newline at end of file diff --git a/pages/me/index.vue b/pages/me/index.vue new file mode 100644 index 0000000..e875c56 --- /dev/null +++ b/pages/me/index.vue @@ -0,0 +1,13 @@ + + + + + \ No newline at end of file diff --git a/pages/servers/[serverId]/channels/[channelId].vue b/pages/servers/[serverId]/channels/[channelId].vue index 4873094..e7ab32a 100644 --- a/pages/servers/[serverId]/channels/[channelId].vue +++ b/pages/servers/[serverId]/channels/[channelId].vue @@ -18,7 +18,7 @@
-
@@ -33,6 +33,7 @@