We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I use gorilla mux. When I access the flash message. The flash message is always stored and cannot be lost. Is there any solution ?
var SessionCookie = newCookieStore() func newCookieStore() *sessions.CookieStore { authKey := []byte("my-auth-key-very-secret") encryptionKey := []byte("my-encryption-key-very-secret123") store := sessions.NewCookieStore(authKey,encryptionKey) store.Options.Path = "/" store.Options.MaxAge = 86400 * 7 //expired dalam seminggu store.Options.HttpOnly = true return store } func SetFlashdata(w http.ResponseWriter, r *http.Request, name, value string){ session, _ := SessionCookie.Get(r, "fmessages") session.AddFlash(value, name) session.Save(r, w) } func GetFlashdata(w http.ResponseWriter, r *http.Request, name string) []string { session, _ := SessionCookie.Get(r, "fmessages") fm := session.Flashes(name) //IF we have some message if len(fm) > 0 { session.Save(r, w) //initiate a strings slice to return messages var flashes []string for _, fl := range fm { //Add message to the slice flashes = append(flashes, fl.(string)) } return flashes } return nil }
The text was updated successfully, but these errors were encountered:
This issue has been automatically marked as stale because it hasn't seen a recent update. It'll be automatically closed in a few days.
Sorry, something went wrong.
@madasatya6 i have a same problem. you found a solution?
@jackbaron #163 (comment)
No branches or pull requests
I use gorilla mux. When I access the flash message. The flash message is always stored and cannot be lost. Is there any solution ?
The text was updated successfully, but these errors were encountered: