-
Notifications
You must be signed in to change notification settings - Fork 603
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: remove deprecated Evented API usage from the public session service #2526
feat: remove deprecated Evented API usage from the public session service #2526
Conversation
5bb32dc
to
698fa2f
Compare
I'm not sure what I am doing wrong, but |
@RobbieTheWagner |
I am calling the setup method and have been for a long time, so it's not that. |
Other scenario could be misplaced I don't see how else it could break other than the service not existing at all. You could inspect the The event logic was also removed from the public service only while the internal one still has them and they are actually being used for triggering the Technically you could do It's hard to talk about this without any code, but everything should work the same as long as mixins were correctly replaced with the session methods. If there are no events being sent then it could be that an authenticator is failing, but in that case you should at least see something logged to the console. |
@BobrImperator this is the PR updating things. It has a failing test because We do use https://github.com/adopted-ember-addons/ember-cognito and I am not sure if it needs changes to work with latest? |
I made a PR for Swach, please see: shipshapecode/swach#1736 |
Hey @BobrImperator, upgrading an ember app and hit What is the correct way to have a component re-render upon app authentication now? Also the event api still in the docs? https://ember-simple-auth.com/api/SessionService.html#.event:authenticationSucceeded |
Hi @hoIIer The Evented API had been removed from the service, a direct replacement would be extending the service and implementing a e.g. Test app example import { inject as service } from '@ember/service';
import Session from 'ember-simple-auth/services/session';
export default class SessionService extends Session {
handleAuthentication() {
super.handleAuthentication(...arguments);
// Do you thing here
}
} Although if your only requirement is to render a specific thing on authenticated session, then you should be able to use the service's {{!-- app/templates/application.hbs --}}
<div class="menu">
…
{{#if this.session.isAuthenticated}}
<a {{on "click" this.invalidateSession}}>Logout</a>
{{else}}
{{#link-to 'login'}}Login{{/link-to}}
{{/if}}
</div>
<div class="main">
{{outlet}}
</div> See Walkthrough and Other guides in the readme Lastly
That appears to be a mistake, since the public SessionService doesn't emit anything and only hooks itself up to the internal, private one. |
handleAuthentication
andhandleInvalidation
methods should be used instead.Example usage of
handleAuthentication
https://github.com/mainmatter/ember-simple-auth/blob/master/guides/managing-current-user.md