mirror of
https://github.com/snowykami/neo-blog.git
synced 2025-09-05 16:56:22 +00:00
feat: create random labels page feat: implement login page with OpenID Connect support feat: add Gravatar component for user avatars feat: create Navbar component with navigation menu chore: create Sidebar component placeholder feat: implement login form with OIDC and email/password options feat: add reusable button component feat: create card component for structured content display feat: implement input component for forms feat: create label component for form labels feat: add navigation menu component for site navigation chore: add configuration file for site metadata feat: implement device context for responsive design feat: add utility functions for class name management feat: define OIDC configuration model feat: define base response model for API responses feat: define user model for user data feat: implement i18n for internationalization support feat: add English and Chinese translations for login chore: create index for locale resources chore: add blog home view placeholder
44 lines
926 B
Go
44 lines
926 B
Go
package resps
|
|
|
|
import (
|
|
"github.com/cloudwego/hertz/pkg/app"
|
|
"github.com/cloudwego/hertz/pkg/common/utils"
|
|
)
|
|
|
|
func Custom(c *app.RequestContext, status int, message string, data any) {
|
|
c.JSON(status, utils.H{
|
|
"status": status,
|
|
"message": message,
|
|
"data": data,
|
|
})
|
|
c.Abort()
|
|
}
|
|
|
|
func Ok(c *app.RequestContext, message string, data any) {
|
|
Custom(c, 200, message, data)
|
|
}
|
|
|
|
func Redirect(c *app.RequestContext, url string) {
|
|
c.Redirect(302, []byte(url))
|
|
}
|
|
|
|
func BadRequest(c *app.RequestContext, message string) {
|
|
Custom(c, 400, message, nil)
|
|
}
|
|
|
|
func Unauthorized(c *app.RequestContext, message string) {
|
|
Custom(c, 401, message, nil)
|
|
}
|
|
|
|
func Forbidden(c *app.RequestContext, message string) {
|
|
Custom(c, 403, message, nil)
|
|
}
|
|
|
|
func NotFound(c *app.RequestContext, message string) {
|
|
Custom(c, 404, message, nil)
|
|
}
|
|
|
|
func InternalServerError(c *app.RequestContext, message string) {
|
|
Custom(c, 500, message, nil)
|
|
}
|