On Friday, September 16, 2016 at 6:07:42 PM UTC+1, Erik Lott wrote:
>
> Rupert, here is a high level overview of how we currently structure our 
> elm SPAs:
>
>    1. Top layer: This layer manages routing, page changes, and page 
>    resource loading, and current user state
>    2. Page layer: These are individual pages - typically one page for 
>    each url. There may be deeper levels of widgets/views within each 
>    page, but we don't have pages nested within pages.
>
>
> When the top layer is notified of a page change (this mechanism can vary 
> from app to app), it first communicates with the backend server to load any 
> resources that are needed to display that page. If the resource load 
> succeeds, the page is displayed by changing the 'currentRoute' to the new 
> routing state, and providing the loaded resources to the new page. If the 
> load fails, however, you can check the http error to determine why. If 
> you're received a 401 failure, you can quickly change to your "login route" 
> and ask the user to login.
>
> Keep in mind that method allows you to catch and mange http errors that 
> occur during page transitions, and not from http requests made from within 
> a page. We're fine with that tradeoff, because 99% of the time, you'll only 
> need to catch 401 during page transitions anyways.
>
> Hopefully that helps.
>

Very enlightening thanks.

What about POSTs from pages? For example, I have a page which shows user 
accounts (to an admin), and will also allow a new user account to be 
created. It would seem natural to POST the new account from within that 
page. Or do you do that from the top-level too? 

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to