Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

after logged-in the menu didn't change #24

Open
h1deOnBush opened this issue Sep 23, 2020 · 1 comment
Open

after logged-in the menu didn't change #24

h1deOnBush opened this issue Sep 23, 2020 · 1 comment

Comments

@h1deOnBush
Copy link

After I log in, the options in the menu bar are still register and login

@m1ckswagger
Copy link

You need to update the render() function in main.go in order to pass the variable to the templates.

func render(c *gin.Context, data gin.H, templateName string) {
    loggedInInterface, _ := c.Get("is_logged_in")
    data["is_logged_in"] = loggedInInterface.(bool)

    switch c.Request.Header.Get("Accept") {
    case "application/json":
	c.JSON(http.StatusOK, data["payload"])
    case "application/xml":
	c.XML(http.StatusOK, data["payload"])
    default:
	c.HTML(http.StatusOK, templateName, data)
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants