You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
590 B
27 lines
590 B
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)
|
|
}
|