module_index_act_logout.go 387 B

12345678910111213141516171819
  1. package modules
  2. import (
  3. "golang-fave/engine/wrapper"
  4. )
  5. func (this *Modules) RegisterAction_IndexUserLogout() *Action {
  6. return this.newAction(AInfo{
  7. WantDB: true,
  8. Mount: "index-user-logout",
  9. WantUser: true,
  10. }, func(wrap *wrapper.Wrapper) {
  11. // Reset session var
  12. wrap.S.SetInt("UserId", 0)
  13. // Reload current page
  14. wrap.Write(`window.location.reload(false);`)
  15. })
  16. }