Skip to content

reduce toSession proliferation #79

@Hermanverschooten

Description

@Hermanverschooten

In the code as supplied here, each page needs to have a toSession method exposed that essentially just returns the session field out of its model. Why not make this more generic?

getSession: { a | session: Session } -> Session
getSession =
    session

Then you can replace the calls in the case statement:

        ...
        Home home ->
            Home.toSession home

        Settings settings ->
            Settings.toSession settings

with

        ...
        Home home ->
           getSession home

        Settings settings ->
            getSession settings

And there is no longer a need to have a toSession in the pages, unless you want it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions