Merge branch 'main' into server-side-token
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
Some checks failed
ci/woodpecker/push/build-and-publish Pipeline failed
This commit is contained in:
commit
df550b561a
40 changed files with 556 additions and 195 deletions
|
@ -33,8 +33,13 @@ export const useApi = () => {
|
|||
return await fetchWithApi(`/users/${userId}`);
|
||||
}
|
||||
|
||||
async function fetchFriends(): Promise<UserResponse[] | undefined> {
|
||||
return await fetchWithApi('/me/friends')
|
||||
async function fetchFriends(): Promise<UserResponse[]> {
|
||||
const response = await fetchWithApi('/me/friends')
|
||||
if (Array.isArray(response)) {
|
||||
return response
|
||||
} else {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
async function addFriend(username: string): Promise<void> {
|
||||
|
@ -74,6 +79,14 @@ export const useApi = () => {
|
|||
await fetchWithApi("/auth/verify-email", { method: "POST", body: { email } });
|
||||
}
|
||||
|
||||
async function sendPasswordResetEmail(identifier: string): Promise<void> {
|
||||
await fetchWithApi("/auth/reset-password", { method: "GET", query: { identifier } });
|
||||
}
|
||||
|
||||
async function resetPassword(password: string, token: string) {
|
||||
await fetchWithApi("/auth/reset-password", { method: "POST", body: { password, token } });
|
||||
}
|
||||
|
||||
return {
|
||||
fetchGuilds,
|
||||
fetchGuild,
|
||||
|
@ -92,6 +105,8 @@ export const useApi = () => {
|
|||
joinGuild,
|
||||
createChannel,
|
||||
fetchInstanceStats,
|
||||
sendVerificationEmail
|
||||
sendVerificationEmail,
|
||||
sendPasswordResetEmail,
|
||||
resetPassword
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue