diff --git a/src/api/relationships.ts b/src/api/relationships.ts index 37b62a3..b2063ea 100644 --- a/src/api/relationships.ts +++ b/src/api/relationships.ts @@ -11,6 +11,7 @@ export interface Relationship { subscription_from: boolean, showing_reblogs: boolean, showing_replies: boolean, + muting: boolean, } export async function follow( @@ -70,6 +71,40 @@ export async function unfollow( } } +export async function mute( + authToken: string, + accountId: string, +): Promise { + const url = `${BACKEND_URL}/api/v1/accounts/${accountId}/mute` + const response = await http(url, { + method: "POST", + authToken, + }) + const data = await response.json() + if (response.status !== 200) { + throw new Error(data.error_description) + } else { + return data + } +} + +export async function unmute( + authToken: string, + accountId: string, +): Promise { + const url = `${BACKEND_URL}/api/v1/accounts/${accountId}/unmute` + const response = await http(url, { + method: "POST", + authToken, + }) + const data = await response.json() + if (response.status !== 200) { + throw new Error(data.error_description) + } else { + return data + } +} + interface ProfileListPage { profiles: Profile[]; nextPageUrl: string | null; diff --git a/src/views/Profile.vue b/src/views/Profile.vue index a9c2887..cd535cd 100644 --- a/src/views/Profile.vue +++ b/src/views/Profile.vue @@ -27,6 +27,7 @@
Follows you
Subscription
Subscriber
+
Muted
+
  • + +
  • +
  • + +