package viewmodel import ( "fmt" "git.aiterp.net/AiteRP/aitestory/server" "git.aiterp.net/gisle/wrouter/auth" ) // Base is the basic information used to render the page type Base struct { User struct { ID string Name string Role string LoggedIn bool SessionID string } ViewTitle string } // InitBase initializes the base of the viewmodel func (base *Base) setupBase(user *auth.User, viewTitle string) { if user != nil { base.User.ID = user.FullID() base.User.Name = user.ID base.User.Role = user.Data["role"] base.User.LoggedIn = true base.User.SessionID = user.Session.ID } base.ViewTitle = fmt.Sprintf("%s - %s", viewTitle, server.Main.Config.View.Title) }