[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-22 Thread 'Rupert Smith' via Elm Discuss
On Thursday, September 22, 2016 at 2:26:12 PM UTC+1, Rupert Smith wrote: > > On Wednesday, September 21, 2016 at 3:02:51 PM UTC+1, Erik Lott wrote: >> >> Regarding the outmsg and translating types, you've got 2 options - you >> can either keep the outmsg in the scope of the module, or you can pass

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-22 Thread 'Rupert Smith' via Elm Discuss
On Wednesday, September 21, 2016 at 3:02:51 PM UTC+1, Erik Lott wrote: > > Regarding the outmsg and translating types, you've got 2 options - you can > either keep the outmsg in the scope of the module, or you can pass the > outmsg to the update function from the upper level > Thanks for that, n

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-21 Thread Erik Lott
Regarding the outmsg and translating types, you've got 2 options - you can either keep the outmsg in the scope of the module, or you can pass the outmsg to the update function from the upper level: *Outmsg in scope of module* module MyModule exposing(..) type Msg = DoSomething | DoSom

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-20 Thread 'Rupert Smith' via Elm Discuss
On Sunday, September 18, 2016 at 9:33:14 PM UTC+1, Erik Lott wrote: > > I'm not sure what the outmessage package is that you linked to, but you > don't need a package to manage this. An outmsg is just a messge that is > returned from the update function, to notify the function caller of > someth

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-18 Thread Erik Lott
I'm not sure what the outmessage package is that you linked to, but you don't need a package to manage this. An outmsg is just a messge that is returned from the update function, to notify the function caller of something important that happened internally. If you're new to elm, it's probably b

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-17 Thread 'Rupert Smith' via Elm Discuss
On Saturday, September 17, 2016 at 2:01:54 AM UTC+1, Erik Lott wrote: > > No, our pages make their own HTTP requests from within the page, and do > not delegate the top layer to make requests. The majority of our api > requests are done from within pages, and I think that's likely the case for >

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread Erik Lott
No, our pages make their own HTTP requests from within the page, and do not delegate the top layer to make requests. The majority of our api requests are done from within pages, and I think that's likely the case for most apps. Each of our "pages" manage their own http errors through the use of

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
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: The

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread Erik Lott
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 deepe

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
On Friday, September 16, 2016 at 4:00:39 PM UTC+1, Rupert Smith wrote: > > > I just need to think about how to add functions to query the auth state on > this module too, as it would also be nice to be able to query that all over > the place too. Something like > So to solve this problem I came

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
On Friday, September 16, 2016 at 2:49:25 PM UTC+1, Rupert Smith wrote: > > I think I am going to try the solution from the "Inter-Component > Communication in 0.17" thread. Which is to create pairs of messaging ports. > The module I came with is below. I can import it anywhere and make use of th

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
On Friday, September 16, 2016 at 11:45:44 AM UTC+1, Rupert Smith wrote: > > > On Friday, September 16, 2016 at 10:13:01 AM UTC+1, Rupert Smith wrote: >> >> On Friday, September 16, 2016 at 1:32:06 AM UTC+1, art yerkes wrote: >>> >>> If your login page can send a message to a parent frame, you can u

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
On Friday, September 16, 2016 at 10:13:01 AM UTC+1, Rupert Smith wrote: > > On Friday, September 16, 2016 at 1:32:06 AM UTC+1, art yerkes wrote: >> >> If your login page can send a message to a parent frame, you can use >> Dom.LowLevel.onWindow to receive it in elm. This appeared in 0.17 and is

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
On Friday, September 16, 2016 at 1:32:06 AM UTC+1, art yerkes wrote: > > If your login page can send a message to a parent frame, you can use > Dom.LowLevel.onWindow to receive it in elm. This appeared in 0.17 and is > neat. > The other part that I am trying to get my head around, is where to p

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-16 Thread 'Rupert Smith' via Elm Discuss
On Friday, September 16, 2016 at 1:32:06 AM UTC+1, art yerkes wrote: > > HttpError has BadResponse Int String which you can use to detect non-200 > results to http requests. The way to do it in elm is to write a function > that wraps the creation of login enabled http requests and translates 401

[elm-discuss] Re: Http 401 Interceptor? My 3rd Elm Project - authentication

2016-09-15 Thread art yerkes
HttpError has BadResponse Int String which you can use to detect non-200 results to http requests. The way to do it in elm is to write a function that wraps the creation of login enabled http requests and translates 401 errors into a suitable message (which is why Task.perform has two function