feat: persist sidebar state
This commit is contained in:
parent
61eaa268ab
commit
de0e87cd71
4 changed files with 36 additions and 2 deletions
|
|
@ -13,7 +13,8 @@ const (
|
|||
URLPathKey string = "url_path"
|
||||
ConfigKey string = "config"
|
||||
CSRFTokenKey string = "csrf_token"
|
||||
AppVersionKey string = "app_version"
|
||||
AppVersionKey string = "app_version"
|
||||
SidebarCollapsedKey string = "sidebar_collapsed"
|
||||
)
|
||||
|
||||
func User(ctx context.Context) *model.User {
|
||||
|
|
@ -61,3 +62,12 @@ func AppVersion(ctx context.Context) string {
|
|||
func WithAppVersion(ctx context.Context, version string) context.Context {
|
||||
return context.WithValue(ctx, AppVersionKey, version)
|
||||
}
|
||||
|
||||
func SidebarCollapsed(ctx context.Context) bool {
|
||||
collapsed, _ := ctx.Value(SidebarCollapsedKey).(bool)
|
||||
return collapsed
|
||||
}
|
||||
|
||||
func WithSidebarCollapsed(ctx context.Context, collapsed bool) context.Context {
|
||||
return context.WithValue(ctx, SidebarCollapsedKey, collapsed)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue