mirror of
https://github.com/gotify/server.git
synced 2026-05-06 21:42:07 +08:00
Adjust message api to use new app/client id
This commit is contained in:
committed by
Jannis Mattheis
parent
433a83823b
commit
6dda2606d4
15
api/internalutil.go
Normal file
15
api/internalutil.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"errors"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
func withID(ctx *gin.Context, name string, f func(id uint)) {
|
||||
if id, err := strconv.ParseUint(ctx.Param(name), 10, 32); err == nil {
|
||||
f(uint(id));
|
||||
} else {
|
||||
ctx.AbortWithError(400, errors.New("invalid id"))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user