These are chat archives for jadjoubran/laravel5-angular-material-starter

7th
Mar 2016
Jeff Yeon
@jaesung2061
Mar 07 2016 03:47
Hello, is anyone here?
Is there a reason page controllers are not automatically generated? Is it considered bad practice to have a page controller now?
Jad Joubran
@jadjoubran
Mar 07 2016 08:30
hi @jaesung2061, according to the best practices by angular, yes
the best practice is to have a page with only HTML that binds components together
just like we do in the tutorial
this will make it easier to upgrade to angular 2, promotes code reuse and allows you to keep components separated
Jeff Yeon
@jaesung2061
Mar 07 2016 08:31
I see
how do i handle run blocks with the new version?
it doesn't seem like you guys have anything set up to accomodate run modules
Jeff Yeon
@jaesung2061
Mar 07 2016 08:43
Also, where can i put root level logic?
Jad Joubran
@jadjoubran
Mar 07 2016 08:46
for the run blocks, you could just include it manually
what do you mean by root level logic?
Jeff Yeon
@jaesung2061
Mar 07 2016 09:01
For example, when a user logs in, I prefer to set the user object at the top level controller, since it affects the entire application.
Jad Joubran
@jadjoubran
Mar 07 2016 09:03
hmm you mean a service?
Jeff Yeon
@jaesung2061
Mar 07 2016 09:03
Something I might need to access from the view
Jad Joubran
@jadjoubran
Mar 07 2016 09:03
if in your architecture you have one top level controller, then you can do it
The service can be accessed from the View
you can just assign it to a component/controller instance
if you have a controller, it can work.. but the idea is we only want to suggest best practices since this is a starter package
Personally, I have a UserServicewhere I store most of the User logic
Jeff Yeon
@jaesung2061
Mar 07 2016 09:07
Ok I think that's all the questions i have for now
Jad Joubran
@jadjoubran
Mar 07 2016 09:08
okay :D
Adam Klein
@cmosguy
Mar 07 2016 21:56
Hey @jadjoubran any chance you've given thought to Satelizer?
They just released a JWT authentication hooks in 5.2, are you going to use these?
Jad Joubran
@jadjoubran
Mar 07 2016 21:57
Hi @cmosguy
I'd love to get your input on that actually
Adam Klein
@cmosguy
Mar 07 2016 21:57
ok
Jad Joubran
@jadjoubran
Mar 07 2016 21:58
would you be able to open a PR maybe?
or 1 sec
what are JWT authentication hooks?
Adam Klein
@cmosguy
Mar 07 2016 21:58
hmmm... perhaps
oh, sorry, I meant there is now options between [web] and [api] now in 5.2
the JWT is something that can get easily wired in
you probably already know about that I am assuming
Jad Joubran
@jadjoubran
Mar 07 2016 22:00
yes true, but I haven't thought about how to do it yet
so if you have any suggestion I'd love to hear it
I also have a question for you
Adam Klein
@cmosguy
Mar 07 2016 22:00
Well, I was going to recommend the example that comes with satelizer
Jad Joubran
@jadjoubran
Mar 07 2016 22:00
what are the features in satellizer that can be used to make the JWT auth process much easier? (except for oAuth)
okay do you have a link?
this repository has it all built in
as an example
there is a user example, etc, etc.
it uses a package called Firebase/JWT
it uses the authenitcation middle where to get the token
Jad Joubran
@jadjoubran
Mar 07 2016 22:03
oh nice!
but.. isn't this automatically handled by tymondesign/jwt-auth ?
which is already configured in this repo
Adam Klein
@cmosguy
Mar 07 2016 22:04
probably
not sure
i haven't done that thorough analysis, i thought perhaps you were going to do all that work, lol
Jad Joubran
@jadjoubran
Mar 07 2016 22:05
yes I will
but that's why I wasn't convinced with satellizer.. because I thought that almost everything is there
the only missing piece for me was to provide them out of the box
so I really want to know what I'm missing so that I can provide it by default (if it makes sense)
but providing oAuth out of the box doesn't make sense, because not all people use it and it's very easy to setup using satellizer
Adam Klein
@cmosguy
Mar 07 2016 22:06
Oh, I figured that satelizer has all the JS front end functions you need
i was thinking you include satelizer and just use the services that it provides
Jad Joubran
@jadjoubran
Mar 07 2016 22:07
okay let me show you this:
This is what I had in mind
this.API.post('login', {email, password}).then((response) => {
    this.$localStorage.jwt = response.data.token;
});
and this is what (according to what I know) satellizer can help with:
$auth.login({email, password})
  .then(function(response) {
    // Redirect user here after a successful log in.
  })
  .catch(function(response) {
    // Handle errors here, because restangular's error interceptor wouldn't work for this request
    // for invalid email and/or password.
  });
so maybe there's something I'm missing?
I'm actually thinking of providing a service that does this.. something with a similar API to satellizer but that uses restangular
Adam Klein
@cmosguy
Mar 07 2016 22:11
Right, so that is what I am trying to communicate, if you could do something in your package, where you take care of the authication service like you show above with localstorage
what would help me as developer, is the recommended procedure to easily get Satelizer playing nice with this authentication and to enable the Facebook login easily
if that makes sense, it could be you include a working example that has the FB login from Satelizer playing nice with your authenticaiton idea above
does this make sense?
Jad Joubran
@jadjoubran
Mar 07 2016 22:14
it does, but it's too localized
so maybe a tutorial or recipe would make more sense
Adam Klein
@cmosguy
Mar 07 2016 22:16
yeah, it would be really benificial
first paragraph ;)
Adam Klein
@cmosguy
Mar 07 2016 22:16
just write the code so it snaps in quick
Jad Joubran
@jadjoubran
Mar 07 2016 22:16
this is what I always want to focus on.. other starter projects would just require jquery, angular, bootstrap, and tons of different libraries
Anton Komarev
@a-komarev
Mar 07 2016 22:18
@cmosguy I'll interrupt you a bit... about auth:api in Laravel 5.2
This application is already using dingo API, and as I know it's using own auth. I hope they will switch to native one soon.
Jad Joubran
@jadjoubran
Mar 07 2016 22:19
@a-komarev I'm in favor of switching to native actually, thanks to Laravel 5.2
Adam Klein
@cmosguy
Mar 07 2016 22:19
@a-komarev yes it is slow maturing (Laravel) to actual use this now
Anton Komarev
@a-komarev
Mar 07 2016 22:19
And I'm not sure that if we will switch to using native auth - we could use all the features of dingo api
Jad Joubran
@jadjoubran
Mar 07 2016 22:19
the only thing missing though would be the Content negotiation.. but I'm not sure if anyone's using this anyway
@a-komarev what features of dingo/API are you using?
Adam Klein
@cmosguy
Mar 07 2016 22:20
BTW, @jadjoubran i am also explorying: https://auth0.com/docs/client-platforms/angularjs
And just pay someone else to manage all the user info stuff
Jad Joubran
@jadjoubran
Mar 07 2016 22:21
yeah but this wouldn't work for everyone
Anton Komarev
@a-komarev
Mar 07 2016 22:23
@jadjoubran I've said it as abstract bottleneck... because I didn't dived in code of dingo a lot and used it only for public APIs recently.
Anton Komarev
@a-komarev
Mar 07 2016 22:34
I started to think about it after this issue: dingo/api#788