diff --git a/client/src/client/page.gleam b/client/src/client/page.gleam index 750ec4f..1a58206 100644 --- a/client/src/client/page.gleam +++ b/client/src/client/page.gleam @@ -21,12 +21,12 @@ pub type Page { /// Starts the page model based on the current route pub fn init(route: route.Route) -> Page { case route { - route.Landing -> Landing(landing.empty) - route.Login -> Login(login.empty) - route.Home -> Dashboard(home.empty) - route.NotFound -> NotFound(not_found.empty) - route.Signup -> Signup(signup.empty) - route.Profile -> Profile(profile.empty) - route.RegisterCrew -> RegisterCrew(register_crew.empty) + route.Landing -> Landing(landing.init) + route.Login -> Login(login.init) + route.Home -> Dashboard(home.init) + route.NotFound -> NotFound(not_found.init) + route.Signup -> Signup(signup.init) + route.Profile -> Profile(profile.init) + route.RegisterCrew -> RegisterCrew(register_crew.init) } } diff --git a/client/src/client/page/home.gleam b/client/src/client/page/home.gleam index a4e2fe9..1982387 100644 --- a/client/src/client/page/home.gleam +++ b/client/src/client/page/home.gleam @@ -10,7 +10,7 @@ import shared/role import shared/route import shared/session.{type Session} -pub const empty: Model = Model +pub const init = Model pub type Model { Model diff --git a/client/src/client/page/landing.gleam b/client/src/client/page/landing.gleam index 524b732..ca28ebb 100644 --- a/client/src/client/page/landing.gleam +++ b/client/src/client/page/landing.gleam @@ -3,7 +3,7 @@ import lustre/attribute.{class} import lustre/element/html import shared/session -pub const empty = Model +pub const init = Model pub type Model { Model diff --git a/client/src/client/page/login.gleam b/client/src/client/page/login.gleam index 77ce37d..02237b5 100644 --- a/client/src/client/page/login.gleam +++ b/client/src/client/page/login.gleam @@ -13,7 +13,7 @@ import shared/contract/login as contract import shared/session import shared/user/email -pub const empty = Model(email: "", password: "", loading: False, message: "") +pub const init = Model(email: "", password: "", loading: False, message: "") pub type Model { Model(email: String, password: String, loading: Bool, message: String) diff --git a/client/src/client/page/not_found.gleam b/client/src/client/page/not_found.gleam index ccfc333..b2ebf3a 100644 --- a/client/src/client/page/not_found.gleam +++ b/client/src/client/page/not_found.gleam @@ -3,7 +3,7 @@ import lustre/attribute.{class} import lustre/element import lustre/element/html -pub const empty = Model +pub const init = Model pub type Model { Model diff --git a/client/src/client/page/profile.gleam b/client/src/client/page/profile.gleam index dadd822..c724f4e 100644 --- a/client/src/client/page/profile.gleam +++ b/client/src/client/page/profile.gleam @@ -6,7 +6,7 @@ import lustre/element/html import shared/session.{type Session} import shared/user.{type User} -pub const empty = Model +pub const init = Model pub type Model { Model diff --git a/client/src/client/page/register_crew.gleam b/client/src/client/page/register_crew.gleam index 2f53707..0ddbef9 100644 --- a/client/src/client/page/register_crew.gleam +++ b/client/src/client/page/register_crew.gleam @@ -18,7 +18,7 @@ import shared/contract/register_crew as contract import shared/session.{type Session} import shared/user.{type User} -pub const empty: Model = Model( +pub const init = Model( selected_leader: option.None, crew_leader_name: "", crew_name: "", diff --git a/client/src/client/page/signup.gleam b/client/src/client/page/signup.gleam index e72ceb3..a29aac9 100644 --- a/client/src/client/page/signup.gleam +++ b/client/src/client/page/signup.gleam @@ -13,7 +13,7 @@ import shared/contract/signup as contract import shared/role import shared/session -pub const empty = Model( +pub const init = Model( user_name: "", user_email: "", user_phone: "", @@ -105,12 +105,12 @@ pub fn update(model: Model, msg: Msg) -> #(Model, Effect(Msg)) { } ApiReturnedResponse(Ok(_created)) -> #( - Model(..empty, loading: False), + Model(..init, loading: False), effect.none(), ) ApiReturnedResponse(Error(_)) -> #( - Model(..empty, loading: False), + Model(..init, loading: False), effect.none(), ) } diff --git a/client/test/page/login_test.gleam b/client/test/page/login_test.gleam index 627693a..fc4624d 100644 --- a/client/test/page/login_test.gleam +++ b/client/test/page/login_test.gleam @@ -20,7 +20,7 @@ pub fn login_test() { let #(model, _) = list.fold( over: sequence, - from: #(login.empty, effect.none()), + from: #(login.init, effect.none()), with: fn(acc, msg) { let assert login.Continue(model, _) = login.update(acc.0, msg) #(model, effect.none()) @@ -46,7 +46,7 @@ pub fn login_success_test() { let model = Ok(session.Authenticated(want)) |> login.ApiReturnedSession - |> login.update(login.empty, _) + |> login.update(login.init, _) let assert login.ServerAuthenticatedUser(resp) = model let assert session.Authenticated(got) = resp @@ -58,7 +58,7 @@ pub fn login_failure_test() { let model = Error(rsvp.NetworkError) |> login.ApiReturnedSession - |> login.update(login.empty, _) + |> login.update(login.init, _) let assert login.ServerFailedToAuthenticate(_) = model }