fix: fix route conflicts

This commit is contained in:
Damillora 2022-04-16 02:35:35 +07:00
parent f2c6d852a9
commit e175d12ca7
2 changed files with 6 additions and 2 deletions

View File

@ -10,11 +10,14 @@ import (
)
func InitializeTagRoutes(g *gin.Engine) {
autocomplete := g.Group("/api/tag-autocomplete")
{
autocomplete.GET("/", tagAutocomplete)
}
unprotected := g.Group("/api/tag")
{
unprotected.GET("/", tagGet)
unprotected.GET("/:tag", tagGetOne)
unprotected.GET("/autocomplete", tagAutocomplete)
}
protected := g.Group("/api/tag").Use(middleware.AuthMiddleware())
{
@ -36,6 +39,7 @@ func tagGetOne(c *gin.Context) {
Code: http.StatusBadRequest,
Message: err.Error(),
})
c.Abort()
}
c.JSON(http.StatusOK, models.TagReadModel{

View File

@ -49,7 +49,7 @@ export async function getTag({ tag }) {
}
export async function getTagAutocomplete() {
const endpoint = url + "/api/tag/autocomplete";
const endpoint = url + "/api/tag-autocomplete";
const response = await axios.get(endpoint);
return response.data;
}