fix: post creation and editing not working
This commit is contained in:
1 parent
600a50d9c8
commit
720ae81aa8
1 file changed
+6
-6
@@ -61,7 +61,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (passedCommunity) {
|
if (passedCommunity) {
|
||||||
data.community.community_view = passedCommunity.id
|
data.community = passedCommunity.id
|
||||||
communitySearch = passedCommunity.name
|
communitySearch = passedCommunity.name
|
||||||
} else {
|
} else {
|
||||||
const list = await getClient().listCommunities({
|
const list = await getClient().listCommunities({
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
async function submit() {
|
async function submit() {
|
||||||
if ((!data.community.community_view || communitySearch == '') && !edit) {
|
if ((!data.community || communitySearch == '') && !edit) {
|
||||||
toast({
|
toast({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
content: 'You need to set a community.',
|
content: 'You need to set a community.',
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
data.url = image || data.url || undefined
|
data.url = image || data.url || undefined
|
||||||
const post = await getClient().createPost({
|
const post = await getClient().createPost({
|
||||||
auth: $profile.jwt,
|
auth: $profile.jwt,
|
||||||
community_id: data.community.community_view!,
|
community_id: data.community!,
|
||||||
name: data.title,
|
name: data.title,
|
||||||
body: data.body,
|
body: data.body,
|
||||||
url: data.url,
|
url: data.url,
|
||||||
@@ -183,7 +183,7 @@
|
|||||||
<span class="block my-1 font-bold text-sm">
|
<span class="block my-1 font-bold text-sm">
|
||||||
Community <span class="text-red-500">*</span>
|
Community <span class="text-red-500">*</span>
|
||||||
</span>
|
</span>
|
||||||
{#if data.community.community_view}
|
{#if data.community}
|
||||||
<Icon
|
<Icon
|
||||||
src={Check}
|
src={Check}
|
||||||
mini
|
mini
|
||||||
@@ -211,11 +211,11 @@
|
|||||||
bind:query={communitySearch}
|
bind:query={communitySearch}
|
||||||
extractSelected={(c) => {
|
extractSelected={(c) => {
|
||||||
if (!c) {
|
if (!c) {
|
||||||
data.community.community_view = null
|
data.community = null
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
data.community.community_view = c.id
|
data.community = c.id
|
||||||
communitySearch = `${c.name}@${new URL(c.actor_id).hostname}`
|
communitySearch = `${c.name}@${new URL(c.actor_id).hostname}`
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in new issue
Block a user