You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why? Is this repeated in multiple places? (I'm not well-versed with this code, but it looks like this wouldn't give us anything)
oh no it would not improve anything with this code since it's not repeated as you pointed out.
however I think it's a really good pattern to adhere to when it comes to auth guards, so to me it makes sense that you would include such a function in the code generated by the official svelte CLI if you understand what I mean.
as Rich wrote in the PR description:
It's also useful if you need to do auth stuff. For example we can make a utility function that redirects the user to /login if they're not logged in already
so I figured why not encourage just this use case?
most real sites have more than one protected route, if you have a protected route at all, so this will have to be rewritten and reused soon enough IMHO.
in a slightly similar vein, the lucia integration also adds a validatePassword which is not repeated and yet it is included because I assume it is good practice and it makes the good easier to read and maintain.
so maybe the only criteria is not "is this repeated in multiple places?", is what I am trying to get across, not sure if I succeeded.
I think it would make sense if this check:
cli/packages/addons/lucia/index.ts
Lines 539 to 544 in d1f4432
was rewritten into a shared function using the new
getRequestEvent
The text was updated successfully, but these errors were encountered: