mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-12-22 16:03:45 +00:00
fix: fix post handling
This commit is contained in:
parent
44eebcedfb
commit
9ff897a14f
@ -170,6 +170,7 @@ func postUpdate(c *gin.Context) {
|
||||
Code: http.StatusBadRequest,
|
||||
Message: err.Error(),
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
c.JSON(http.StatusOK, models.PostListItem{
|
||||
|
@ -72,9 +72,6 @@ func UpdatePost(id string, model models.PostUpdateModel) (*database.Post, error)
|
||||
if result.Error != nil {
|
||||
return nil, result.Error
|
||||
}
|
||||
|
||||
database.DB.Model(&post).Association("Tags").Replace(tags)
|
||||
|
||||
post.SourceURL = model.SourceURL
|
||||
|
||||
result = database.DB.Save(&post)
|
||||
@ -82,6 +79,10 @@ func UpdatePost(id string, model models.PostUpdateModel) (*database.Post, error)
|
||||
return nil, result.Error
|
||||
}
|
||||
|
||||
err = database.DB.Model(&post).Association("Tags").Replace(tags)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &post, nil
|
||||
|
||||
}
|
||||
|
@ -51,15 +51,16 @@
|
||||
searchTerms = value.detail.tags;
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
$: {
|
||||
queryParams = queryString.parse(location.search);
|
||||
if (queryParams.tags) {
|
||||
searchTerms = queryParams.tags.split(" ");
|
||||
} else {
|
||||
searchTerms = [];
|
||||
}
|
||||
posts = [];
|
||||
getData();
|
||||
});
|
||||
}
|
||||
|
||||
const onSearch = (i) => {
|
||||
if (searchTerms.length > 0) {
|
||||
@ -115,15 +116,15 @@
|
||||
</Link>
|
||||
</figure>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
{#if post.tags}
|
||||
<div class="card-content">
|
||||
{#if post.tags}
|
||||
{#each post.tags as tag (tag)}
|
||||
<TagLink {tag} />
|
||||
{/each}
|
||||
{:else}
|
||||
<TagLink tag="tagme" />
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<TagLink tag="tagme" />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/each}
|
||||
|
Loading…
Reference in New Issue
Block a user