mirror of
https://github.com/Damillora/Shioriko.git
synced 2024-11-22 04:17:33 +00:00
fix: fix route conflicts
This commit is contained in:
parent
f2c6d852a9
commit
e175d12ca7
@ -10,11 +10,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func InitializeTagRoutes(g *gin.Engine) {
|
func InitializeTagRoutes(g *gin.Engine) {
|
||||||
|
autocomplete := g.Group("/api/tag-autocomplete")
|
||||||
|
{
|
||||||
|
autocomplete.GET("/", tagAutocomplete)
|
||||||
|
}
|
||||||
unprotected := g.Group("/api/tag")
|
unprotected := g.Group("/api/tag")
|
||||||
{
|
{
|
||||||
unprotected.GET("/", tagGet)
|
unprotected.GET("/", tagGet)
|
||||||
unprotected.GET("/:tag", tagGetOne)
|
unprotected.GET("/:tag", tagGetOne)
|
||||||
unprotected.GET("/autocomplete", tagAutocomplete)
|
|
||||||
}
|
}
|
||||||
protected := g.Group("/api/tag").Use(middleware.AuthMiddleware())
|
protected := g.Group("/api/tag").Use(middleware.AuthMiddleware())
|
||||||
{
|
{
|
||||||
@ -36,6 +39,7 @@ func tagGetOne(c *gin.Context) {
|
|||||||
Code: http.StatusBadRequest,
|
Code: http.StatusBadRequest,
|
||||||
Message: err.Error(),
|
Message: err.Error(),
|
||||||
})
|
})
|
||||||
|
c.Abort()
|
||||||
}
|
}
|
||||||
|
|
||||||
c.JSON(http.StatusOK, models.TagReadModel{
|
c.JSON(http.StatusOK, models.TagReadModel{
|
||||||
|
@ -49,7 +49,7 @@ export async function getTag({ tag }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getTagAutocomplete() {
|
export async function getTagAutocomplete() {
|
||||||
const endpoint = url + "/api/tag/autocomplete";
|
const endpoint = url + "/api/tag-autocomplete";
|
||||||
const response = await axios.get(endpoint);
|
const response = await axios.get(endpoint);
|
||||||
return response.data;
|
return response.data;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user