Initial Commit
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
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 {
|
||||
UserName string
|
||||
UserRole string
|
||||
UserLoggedIn bool
|
||||
ViewTitle string
|
||||
}
|
||||
|
||||
// InitBase initializes the base of the viewmodel
|
||||
func (base *Base) InitBase(user *auth.User, viewTitle string) {
|
||||
if user != nil {
|
||||
base.UserName = user.ID
|
||||
base.UserRole = user.Data["role"]
|
||||
base.UserLoggedIn = false
|
||||
}
|
||||
|
||||
base.ViewTitle = fmt.Sprintf("%s - %s", viewTitle, server.Main.Config.View.Title)
|
||||
}
|
||||
Reference in New Issue
Block a user