2017-06-18 15:16:40 +00:00
|
|
|
package settings
|
|
|
|
|
|
|
|
import (
|
2017-06-21 00:51:55 +00:00
|
|
|
"net/http"
|
|
|
|
|
2017-06-18 15:16:40 +00:00
|
|
|
"github.com/aerogo/aero"
|
2019-06-03 09:32:43 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn"
|
2017-06-18 15:16:40 +00:00
|
|
|
)
|
|
|
|
|
2017-11-05 07:16:20 +00:00
|
|
|
// Get settings.
|
2019-06-01 04:55:49 +00:00
|
|
|
func Get(component func(*arn.User) string) func(aero.Context) error {
|
|
|
|
return func(ctx aero.Context) error {
|
2019-11-17 07:59:34 +00:00
|
|
|
user := arn.GetUserFromContext(ctx)
|
2017-06-18 15:16:40 +00:00
|
|
|
|
2017-11-05 07:16:20 +00:00
|
|
|
if user == nil {
|
2018-07-07 03:42:00 +00:00
|
|
|
return ctx.Error(http.StatusUnauthorized, "Not logged in")
|
2017-11-05 07:16:20 +00:00
|
|
|
}
|
2017-06-18 15:16:40 +00:00
|
|
|
|
2017-11-05 07:16:20 +00:00
|
|
|
return ctx.HTML(component(user))
|
|
|
|
}
|
2017-06-18 15:16:40 +00:00
|
|
|
}
|