mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-11-22 04:17:33 +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,
|
Code: http.StatusBadRequest,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
})
|
})
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, models.PostListItem{
|
c.JSON(http.StatusOK, models.PostListItem{
|
||||||
|
@ -72,9 +72,6 @@ func UpdatePost(id string, model models.PostUpdateModel) (*database.Post, error)
|
|||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
return nil, result.Error
|
return nil, result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
database.DB.Model(&post).Association("Tags").Replace(tags)
|
|
||||||
|
|
||||||
post.SourceURL = model.SourceURL
|
post.SourceURL = model.SourceURL
|
||||||
|
|
||||||
result = database.DB.Save(&post)
|
result = database.DB.Save(&post)
|
||||||
@ -82,6 +79,10 @@ func UpdatePost(id string, model models.PostUpdateModel) (*database.Post, error)
|
|||||||
return nil, result.Error
|
return nil, result.Error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = database.DB.Model(&post).Association("Tags").Replace(tags)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
return &post, nil
|
return &post, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,15 +51,16 @@
|
|||||||
searchTerms = value.detail.tags;
|
searchTerms = value.detail.tags;
|
||||||
};
|
};
|
||||||
|
|
||||||
onMount(() => {
|
$: {
|
||||||
queryParams = queryString.parse(location.search);
|
queryParams = queryString.parse(location.search);
|
||||||
if (queryParams.tags) {
|
if (queryParams.tags) {
|
||||||
searchTerms = queryParams.tags.split(" ");
|
searchTerms = queryParams.tags.split(" ");
|
||||||
} else {
|
} else {
|
||||||
searchTerms = [];
|
searchTerms = [];
|
||||||
}
|
}
|
||||||
|
posts = [];
|
||||||
getData();
|
getData();
|
||||||
});
|
}
|
||||||
|
|
||||||
const onSearch = (i) => {
|
const onSearch = (i) => {
|
||||||
if (searchTerms.length > 0) {
|
if (searchTerms.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user