fix: upload tag error

This commit is contained in:
Damillora 2021-09-11 02:11:10 +07:00
parent 63b19dcf0f
commit 16c9f998d5
3 changed files with 4 additions and 5 deletions

View File

@ -21,14 +21,14 @@ func GetTagAll() []models.TagListItem {
return tags
}
func GetTagAutocomplete() []models.TagAutocompleteListItem {
var tags []models.TagAutocompleteListItem
func GetTagAutocomplete() []string {
var tags []string
result := database.DB.Model(&database.Tag{}).
Joins("join tag_types on tag_types.id = tags.tag_type_id").
Select("concat(tag_types.name,':',tags.name) as name").
Find(&tags)
if result.Error != nil {
return []models.TagAutocompleteListItem{}
return []string{}
}
return tags
}

View File

@ -94,7 +94,6 @@
addKeys={[9, 32]}
on:tags={onTagChange}
autoComplete={onAutocomplete}
autoCompleteKey={"name"}
/>
</div>
</div>

View File

@ -112,7 +112,7 @@
<div class="field">
<label for="tags" class="label">Tags</label>
<div class="control" id="tags">
<Tags addKeys={[9, 32]} on:tags={onTagChange} autoComplete={onAutocomplete} autoCompleteKey={"name"} />
<Tags addKeys={[9, 32]} on:tags={onTagChange} autoComplete={onAutocomplete} />
</div>
</div>
<div class="control">