Ember-simple-auth Сессия истекает при обновлении страницы - PullRequest
0 голосов
/ 10 октября 2018

/ app / login / controller.js

import Controller from '@ember/controller';
import { inject } from '@ember/service';

export default Controller.extend({
    session: inject('session'),
    actions: {
        authenticate: function(){
            // let _this = this;
            let credentials = this.getProperties('identification','password');
            let authenticator = 'authenticator:jwt';
            this.get('session').authenticate(authenticator, credentials).catch((reason)=>{
                // this.set('errorMessage', reason.error || reason);
                this.set('errorMessage','Login Failed');
            });
        }
    }
});

/ app / profile / controller.js

import Controller from '@ember/controller';
import { inject } from '@ember/service';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';

export default Controller.extend(AuthenticatedRouteMixin, {
    session: inject('session'),
});

/ config / environment.js

.....

ENV['ember-simple-auth'] = {
    authorizer: 'authorizer:custom',
    routeAfterAuthentication: '/profiles',
  };


....

Когда я войду в систему с необходимыми учетными данными, он будет перенаправлен на Профиль маршрута , а затем, когда я обновлю страницу,сессия истекает, Предложите решение,

...