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