Display a message if not in the current promo

This commit is contained in:
nemunaire 2022-02-21 09:21:30 +01:00
parent f0d5296a31
commit b7029b643e
2 changed files with 26 additions and 7 deletions

View file

@ -26,11 +26,16 @@ func init() {
router.POST("/api/auth/logout", apiRawHandler(logout))
}
type authToken struct {
*User
CurrentPromo uint `json:"current_promo"`
}
func validateAuthToken(u *User, _ httprouter.Params, _ []byte) HTTPResponse {
if u == nil {
return APIErrorResponse{status: http.StatusUnauthorized, err: fmt.Errorf("Not connected")}
} else {
return APIResponse{u}
return APIResponse{authToken{u, currentPromo}}
}
}