Skip to content

Update Init User code #574

@DiroM1693

Description

@DiroM1693
func InitUser(c *fiber.Ctx) error {
	uid := c.Locals(UID).(string)
	user, err := models.PrivateUserByUid(uid)
	if errors.Is(err, sql.ErrNoRows) {
		return registerUser(c)
	}

	if err != nil {
		return err
	}

	user.ConvertUser()

	c.Locals(CurrentUser, user)
	return c.Next()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions