Welcome the channel on the development of Cro, a set of libraries for building reactive distributed systems, lovingly crafted to take advantage of all the Raku Programming Language has to offer (cro.services). This channel is being logged for historical purposes. Set by lizmat on 24 May 2021. |
|||
01:41
japhb left,
japhb joined
01:51
japhb left
02:02
japhb joined
|
|||
disbot3 | <romdav55_30502> Hello | 02:48 | |
<romdav55_30502> Whats the best aproach for redirects on user protected areas? | |||
<romdav55_30502> i have this | |||
<romdav55_30502> route { get -> 'dashboard',*@path { if !(request.auth.is-logged-in) { redirect :see-other, '/user/login'; } else { content 'text/html', "User content"; } } } | |||
<romdav55_30502> But i looking for a way to do this | 02:50 | ||
<romdav55_30502> route { get -> 'dashboard',*@path { if !(request.auth.is-logged-in) { redirect :see-other, '/user/login'; # Some whay to finish the request here } content 'text/html', "User content"; } } | |||
<romdav55_30502> Or there are a better whay? | |||
03:51
guifa left
09:19
lizmat left
11:38
guifa joined
15:42
librasteve_ joined
|
|||
disbot3 | <librasteve> @romdav55_30502 just reminding myself of the docs cro.raku.org/docs/reference/cro-ht..._responses | 16:13 | |
<librasteve> that also covers the three argument variant of redirect that lets you include a body this is precisely equivalent to calling content after redirect | 16:18 | ||
<librasteve> otherwise I am not entirely sure what you mean by "finish the request" ...I guess the standard behaviour of redirect() is to return from the route immediately ... on which case any code after the line contaniing the redirect() call will not run | 16:20 | ||
<librasteve> I have not tested this, you can check my guess by putting note 42 there which will send 42 to STDOUT / log | 16:21 | ||
19:05
guifa left
21:42
lizmat joined
22:22
librasteve_ left
23:57
guifa joined
|