Expose ActionData types.

This commit is contained in:
Dillon Kearns 2022-05-03 11:51:32 -07:00
parent 5a664782cd
commit ad8e7b9456
16 changed files with 135 additions and 62 deletions

View File

@ -1,4 +1,4 @@
module Route.BasicAuth exposing (Data, Model, Msg, route)
module Route.BasicAuth exposing (ActionData, Data, Model, Msg, route)
import Base64
import DataSource exposing (DataSource)
@ -25,11 +25,12 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action"
}
|> RouteBuilder.buildNoState { view = view }
@ -39,6 +40,10 @@ type alias Data =
}
type alias ActionData =
{}
data : RouteParams -> Parser (DataSource (Response Data ErrorPage))
data routeParams =
withBasicAuth
@ -53,7 +58,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
[]
@ -62,7 +67,7 @@ head static =
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Basic Auth Test"

View File

@ -1,4 +1,4 @@
module Route.FileUpload exposing (Data, Model, Msg, route)
module Route.FileUpload exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import ErrorPage exposing (ErrorPage)
@ -27,11 +27,12 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildNoState { view = view }
@ -40,6 +41,10 @@ type alias Data =
Maybe Request.File
type alias ActionData =
{}
data : RouteParams -> Request.Parser (DataSource (Server.Response.Response Data ErrorPage))
data routeParams =
Request.oneOf
@ -57,7 +62,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -79,7 +84,7 @@ head static =
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "File Upload"

View File

@ -1,4 +1,4 @@
module Route.Form exposing (Data, Model, Msg, route)
module Route.Form exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import Date exposing (Date)
@ -186,11 +186,12 @@ form user =
)
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildNoState { view = view }
@ -201,6 +202,10 @@ type alias Data =
}
type alias ActionData =
{}
data : RouteParams -> Parser (DataSource (Response Data ErrorPage))
data routeParams =
Request.oneOf
@ -232,7 +237,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -254,7 +259,7 @@ head static =
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
let

View File

@ -1,4 +1,4 @@
module Route.FormEvent exposing (Data, Model, Msg, route)
module Route.FormEvent exposing (ActionData, Data, Model, Msg, route)
import Browser.Navigation
import DataSource exposing (DataSource)
@ -29,7 +29,7 @@ type alias RouteParams =
{}
route : StatefulRoute RouteParams Data Model Msg
route : StatefulRoute RouteParams Data ActionData Model Msg
route =
RouteBuilder.single
{ head = head
@ -46,7 +46,7 @@ route =
init :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> ( Model, Effect Msg )
init maybePageUrl sharedModel static =
( { formAsString = Nothing }, Effect.none )
@ -55,7 +55,7 @@ init maybePageUrl sharedModel static =
update :
PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> Msg
-> Model
-> ( Model, Effect Msg )
@ -81,13 +81,17 @@ type alias Data =
{}
type alias ActionData =
{}
data : DataSource Data
data =
DataSource.succeed {}
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -110,7 +114,7 @@ view :
Maybe PageUrl
-> Shared.Model
-> Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel model static =
{ title = "Placeholder"

View File

@ -1,4 +1,4 @@
module Route.Greet exposing (Data, Model, Msg, route)
module Route.Greet exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import Dict exposing (Dict)
@ -31,11 +31,12 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildNoState { view = view }
@ -86,7 +87,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -112,10 +113,14 @@ type alias Data =
}
type alias ActionData =
{}
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Hello!"

View File

@ -1,4 +1,4 @@
module Route.Hex.Hex_ exposing (Data, Model, Msg, route)
module Route.Hex.Hex_ exposing (ActionData, Data, Model, Msg, route)
import ColorHelpers
import DataSource exposing (DataSource)
@ -21,7 +21,11 @@ type alias Data =
ColorHelpers.Data
route : StatelessRoute RouteParams Data
type alias ActionData =
{}
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.preRenderWithFallback
{ head = ColorHelpers.head toCssVal

View File

@ -1,4 +1,4 @@
module Route.Login exposing (Data, Model, Msg, route)
module Route.Login exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import Dict exposing (Dict)
@ -31,11 +31,12 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildNoState { view = view }
@ -85,7 +86,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -109,10 +110,14 @@ type alias Data =
}
type alias ActionData =
{}
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Login"

View File

@ -1,4 +1,4 @@
module Route.Named.Color_ exposing (Data, Model, Msg, route)
module Route.Named.Color_ exposing (ActionData, Data, Model, Msg, route)
import ColorHelpers
import DataSource exposing (DataSource)
@ -17,11 +17,15 @@ type alias RouteParams =
{ color : String }
type alias ActionData =
{}
type alias Data =
ColorHelpers.Data
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.preRenderWithFallback
{ head = ColorHelpers.head toCssVal

View File

@ -1,4 +1,4 @@
module Route.PokedexNumber_ exposing (Data, Model, Msg, route)
module Route.PokedexNumber_ exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import DataSource.Http
@ -28,7 +28,7 @@ type alias RouteParams =
{ pokedexNumber : String }
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.preRenderWithFallback
{ head = head
@ -79,7 +79,7 @@ type alias Pokemon =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -108,10 +108,14 @@ type alias Data =
}
type alias ActionData =
{}
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = static.data.pokemon.name

View File

@ -1,4 +1,4 @@
module Route.PortTest exposing (Data, Model, Msg, route)
module Route.PortTest exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import DataSource.Port
@ -26,7 +26,7 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.single
{ head = head
@ -40,6 +40,10 @@ type alias Data =
}
type alias ActionData =
{}
data : DataSource Data
data =
DataSource.succeed Data
@ -47,7 +51,7 @@ data =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
[]
@ -56,7 +60,7 @@ head static =
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Placeholder"

View File

@ -1,4 +1,4 @@
module Route.RedirectLinks exposing (Data, Model, Msg, route)
module Route.RedirectLinks exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import Head
@ -24,7 +24,7 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.single
{ head = head
@ -37,13 +37,17 @@ type alias Data =
{}
type alias ActionData =
{}
data : DataSource Data
data =
DataSource.succeed {}
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -65,7 +69,7 @@ head static =
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Placeholder"

View File

@ -1,4 +1,4 @@
module Route.Rgb.Red_.Green_.Blue_ exposing (Data, Model, Msg, route)
module Route.Rgb.Red_.Green_.Blue_ exposing (ActionData, Data, Model, Msg, route)
import ColorHelpers
import DataSource exposing (DataSource)
@ -17,7 +17,7 @@ type alias RouteParams =
{ red : String, green : String, blue : String }
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.preRenderWithFallback
{ head = ColorHelpers.head toCssVal
@ -36,6 +36,10 @@ type alias Data =
ColorHelpers.Data
type alias ActionData =
{}
toCssVal : RouteParams -> String
toCssVal routeParams =
"rgb("

View File

@ -1,4 +1,4 @@
module Route.Secret exposing (Data, Model, Msg, route)
module Route.Secret exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import DataSource.File
@ -29,11 +29,12 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action"
}
|> RouteBuilder.buildNoState { view = view }
@ -43,6 +44,10 @@ type Data
| NotLoggedIn
type alias ActionData =
{}
type alias LoggedInInfo =
{ username : String
, secretNote : String
@ -76,7 +81,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -98,7 +103,7 @@ head static =
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
case static.data of

View File

@ -1,4 +1,4 @@
module Route.TailwindForm exposing (Data, Model, Msg, route)
module Route.TailwindForm exposing (ActionData, Data, Model, Msg, route)
import Browser.Dom
import Css exposing (Color)
@ -545,11 +545,12 @@ cancelButton =
[ Html.text "Cancel" ]
route : StatefulRoute RouteParams Data Model Msg
route : StatefulRoute RouteParams Data ActionData Model Msg
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildWithLocalState
{ view = view
@ -610,6 +611,10 @@ type alias Data =
}
type alias ActionData =
{}
data : RouteParams -> Parser (DataSource (Response Data ErrorPage))
data routeParams =
Request.oneOf
@ -632,7 +637,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -703,7 +708,7 @@ view :
Maybe PageUrl
-> Shared.Model
-> Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel model static =
let

View File

@ -1,4 +1,4 @@
module Route.Time exposing (Data, Model, Msg, route)
module Route.Time exposing (ActionData, Data, Model, Msg, route)
import DataSource exposing (DataSource)
import Dict exposing (Dict)
@ -28,11 +28,12 @@ type alias RouteParams =
{}
route : StatelessRoute RouteParams Data
route : StatelessRoute RouteParams Data ActionData
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildNoState { view = view }
@ -104,7 +105,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -128,10 +129,14 @@ type alias Data =
}
type alias ActionData =
{}
view :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel static =
{ title = "Time"

View File

@ -1,4 +1,4 @@
module Route.Todos exposing (Data, Model, Msg, route)
module Route.Todos exposing (ActionData, Data, Model, Msg, route)
import Api.InputObject
import Api.Mutation
@ -50,11 +50,12 @@ type alias RouteParams =
{}
route : StatefulRoute RouteParams Data Model Msg
route : StatefulRoute RouteParams Data ActionData Model Msg
route =
RouteBuilder.serverRender
{ head = head
, data = data
, action = \_ -> Request.skip "No action."
}
|> RouteBuilder.buildWithLocalState
{ view = view
@ -67,7 +68,7 @@ route =
init :
Maybe PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> ( Model, Effect Msg )
init maybePageUrl sharedModel static =
( { submitting = False
@ -80,7 +81,7 @@ init maybePageUrl sharedModel static =
update :
PageUrl
-> Shared.Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> Msg
-> Model
-> ( Model, Effect Msg )
@ -128,6 +129,10 @@ type alias Data =
}
type alias ActionData =
{}
type alias Todo =
{ description : String
, id : String
@ -213,7 +218,7 @@ data routeParams =
head :
StaticPayload Data RouteParams
StaticPayload Data ActionData RouteParams
-> List Head.Tag
head static =
Seo.summary
@ -236,7 +241,7 @@ view :
Maybe PageUrl
-> Shared.Model
-> Model
-> StaticPayload Data RouteParams
-> StaticPayload Data ActionData RouteParams
-> View Msg
view maybeUrl sharedModel model static =
{ title = "Todos"