mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-24 06:54:03 +03:00
Extract secrets in helper to single definition.
This commit is contained in:
parent
23f32f8cce
commit
94a37fe51f
@ -24,7 +24,7 @@ withSession :
|
||||
withSession =
|
||||
Session.withSession
|
||||
{ name = "mysession"
|
||||
, secrets = Env.expect "SESSION_SECRET" |> DataSource.map List.singleton
|
||||
, secrets = secrets
|
||||
, options = cookieOptions
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ withSessionOrRedirect :
|
||||
withSessionOrRedirect toRequest handler =
|
||||
Session.withSession
|
||||
{ name = "mysession"
|
||||
, secrets = Env.expect "SESSION_SECRET" |> DataSource.map List.singleton
|
||||
, secrets = secrets
|
||||
, options = cookieOptions
|
||||
}
|
||||
(\request sessionResult ->
|
||||
@ -52,6 +52,11 @@ withSessionOrRedirect toRequest handler =
|
||||
handler
|
||||
|
||||
|
||||
secrets : DataSource (List String)
|
||||
secrets =
|
||||
Env.expect "SESSION_SECRET" |> DataSource.map List.singleton
|
||||
|
||||
|
||||
expectSessionOrRedirect :
|
||||
(request -> Session.Session -> DataSource ( Session.Session, Response data errorPage ))
|
||||
-> Parser request
|
||||
@ -59,7 +64,7 @@ expectSessionOrRedirect :
|
||||
expectSessionOrRedirect toRequest handler =
|
||||
Session.withSession
|
||||
{ name = "mysession"
|
||||
, secrets = Env.expect "SESSION_SECRET" |> DataSource.map List.singleton
|
||||
, secrets = secrets
|
||||
, options = cookieOptions
|
||||
}
|
||||
(\request sessionResult ->
|
||||
|
Loading…
Reference in New Issue
Block a user