fix: 登录/注册支持 redirect 参数,未登录跳转自动携带来源页
- login.js/register.js 登录成功后优先跳转 redirect 参数指定页面 - 新增 common.RedirectToLogin 辅助函数,自动携带当前路径 - 替换所有 9 处硬编码 /auth/login 重定向
This commit is contained in:
@ -23,7 +23,7 @@ func NewSpaceController(spaceService spaceUseCase) *SpaceController {
|
||||
func (ctrl *SpaceController) MySpace(c *gin.Context) {
|
||||
uid, _, ok := common.GetGinUser(c)
|
||||
if !ok {
|
||||
c.Redirect(http.StatusFound, "/auth/login")
|
||||
common.RedirectToLogin(c)
|
||||
return
|
||||
}
|
||||
c.Redirect(http.StatusFound, "/space/"+strconv.FormatUint(uint64(uid), 10))
|
||||
|
||||
Reference in New Issue
Block a user