Fix unfollowing (#1552)

This commit is contained in:
Geometrically
2024-01-10 13:43:28 -05:00
committed by GitHub
parent c0275addb0
commit c5974a8575

View File

@@ -308,7 +308,7 @@
<button
v-if="collection.id === 'following'"
class="iconified-button"
@click="userUnfollowProject(project)"
@click="unfollowProject(project)"
>
<TrashIcon />
Unfollow project
@@ -394,13 +394,12 @@ try {
created: auth.value.user.created,
updated: auth.value.user.created,
})
const data = await useAsyncData(`user/${auth.value.user.id}/follows`, () =>
useBaseFetch(`user/${auth.value.user.id}/follows`)
)
projects = ref(data.data)
;[{ data: projects, refresh: refreshProjects }] = await Promise.all([
useAsyncData(`user/${auth.value.user.id}/follows`, () =>
useBaseFetch(`user/${auth.value.user.id}/follows`)
),
])
creator = ref(auth.value.user)
refreshProjects = async () => {}
refreshCollection = async () => {}
} else {
const val = await useAsyncData(`collection/${route.params.id}`, () =>
@@ -474,6 +473,11 @@ const summary = ref(collection.value.description)
const visibility = ref(collection.value.status)
const removeProjects = ref([])
async function unfollowProject(project) {
await userUnfollowProject(project)
projects.value = projects.value.filter((x) => x.id !== project.id)
}
async function saveChanges() {
startLoading()
try {