Skip to content

Instantly share code, notes, and snippets.

@hmarcelodn
Created April 25, 2017 20:29
Show Gist options
  • Select an option

  • Save hmarcelodn/85046ffb8d4497a26e97878fc705e282 to your computer and use it in GitHub Desktop.

Select an option

Save hmarcelodn/85046ffb8d4497a26e97878fc705e282 to your computer and use it in GitHub Desktop.
main.ts
import { Aurelia } from 'aurelia-framework';
import { PLATFORM } from 'aurelia-pal';
import { AuthService } from 'aurelia-auth';
import * as Bluebird from 'bluebird';
import * as AureliaAuth from 'aurelia-auth'
import * as authConfig from './authConfig';
Bluebird.config({ warnings: { wForgottenReturn: false } });
export async function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging()
.plugin(PLATFORM.moduleName('aurelia-auth'), (baseConfig: AureliaAuth.BaseConfig) => {
baseConfig.configure(authConfig.default);
})
.plugin(PLATFORM.moduleName('aurelia-animator-velocity'))
.plugin(PLATFORM.moduleName('aurelia-templating-router'))
.feature(PLATFORM.moduleName('resources/index'));
let authService = aurelia.container.get(AuthService);
await aurelia.start();
await aurelia.setRoot(PLATFORM.moduleName('app/guest/app'));
if(authService.isAuthenticated()){
/*
if(localStorage.getItem("isDeveloper") == "true"){
await aurelia.setRoot(PLATFORM.moduleName('app/developer/app'));
}
else{
await aurelia.setRoot(PLATFORM.moduleName('app/company/app'));
}*/
}
else{
await aurelia.setRoot(PLATFORM.moduleName('app/guest/app'));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment