Skip to content
This repository has been archived by the owner. It is now read-only.

Commit

Permalink
Merge pull request #285 from Tvaroh/pass-state-to-head
Browse files Browse the repository at this point in the history
Pass state to KorolevServiceConfig.head
  • Loading branch information
fomkin authored Oct 19, 2019
2 parents d1443e7 + 1cd8a58 commit cad1152
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion examples/form-data/src/main/scala/FormDataExample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ object FormDataExample extends SimpleAkkaHttpKorolevApp(AkkaHttpServerConfig(max
KorolevServiceConfig[Future, State, Any](
stateStorage = StateStorage.default(State.empty),
router = Router.empty,
head = {
head = _ => {
Seq(
link(
rel :="stylesheet",
Expand Down
2 changes: 1 addition & 1 deletion examples/routing/src/main/scala/RoutingExample.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ object RoutingExample extends SimpleAkkaHttpKorolevApp {
val service = akkaHttpService{
KorolevServiceConfig [Future, State, Any] (
stateStorage = storage,
head = {
head = _ => {
Seq(
title("Main Routing Page"),
link(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object WebComponentExample extends SimpleAkkaHttpKorolevApp {
KorolevServiceConfig [Future, State, Any] (
router = Router.empty,
stateStorage = StateStorage.default(State()),
head = {
head = _ => {
Seq(
script(src := "https://cdnjs.cloudflare.com/ajax/libs/webcomponentsjs/0.7.24/webcomponents-lite.min.js"),
link(rel := "import", href := "https://leaflet-extras.github.io/leaflet-map/bower_components/leaflet-map/leaflet-map.html")
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/main/scala/gp/GuineaPigService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object GuineaPigService {
val service = KorolevServiceConfig[Future, State, Any](
stateStorage = storage,
reporter = korolev.slf4j.Slf4jReporter,
head = {
head = _ => {
Seq(
'title("The Test App"),
'link('href /= "/static/main.css", 'rel /= "stylesheet", 'type /= "text/css"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ case class KorolevServiceConfig[F[_]: Async, S, M](
router: Router[F, S],
rootPath: String = "/",
render: PartialFunction[S, Document.Node[Context.Effect[F, S, M]]],
head: Seq[Document.Node[Context.Effect[F, S, M]]] = Seq.empty,
head: S => Seq[Document.Node[Context.Effect[F, S, M]]] = (_: S) => Seq.empty,
connectionLostWidget: Document.Node[Context.Effect[F, S, M]] =
KorolevServiceConfig.defaultConnectionLostWidget[Context.Effect[F, S, M]],
maxFormDataEntrySize: Int = 1024 * 1024 * 8,
Expand Down
2 changes: 1 addition & 1 deletion server/base/src/main/scala/korolev/server/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ package object server {
'head(
'script('language /= "javascript", kfg),
'script('src /= config.rootPath + "static/korolev-client.min.js", 'defer /= ""),
config.head
config.head(state)
),
config.render(state)
)
Expand Down

0 comments on commit cad1152

Please sign in to comment.