mirror of
https://github.com/sartography/cr-connect-bpmn.git
synced 2025-01-13 10:34:18 +00:00
Uses error interceptor to handle redirecting to login
This commit is contained in:
parent
13b47ba894
commit
4a71a552d6
6
package-lock.json
generated
6
package-lock.json
generated
@ -12291,9 +12291,9 @@
|
|||||||
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
|
||||||
},
|
},
|
||||||
"sartography-workflow-lib": {
|
"sartography-workflow-lib": {
|
||||||
"version": "0.0.177",
|
"version": "0.0.180",
|
||||||
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.177.tgz",
|
"resolved": "https://registry.npmjs.org/sartography-workflow-lib/-/sartography-workflow-lib-0.0.180.tgz",
|
||||||
"integrity": "sha512-lR+3MljVyWj6hPJ/a3bxKhBaZ0CoK5WxNVq6Xb3Qo6CiCbuzG/CJiE3jcS1fsgPDNyLHzCKlwpNH6z95pfPI2w=="
|
"integrity": "sha512-d/ePxdkeIX/ZW3Sp5NIkZsitxRxS560PWorOd9RaojyJtMks2EgCwuN0Gs18NkT0Qrvk7fJHKYYV89k0/H0djQ=="
|
||||||
},
|
},
|
||||||
"sass": {
|
"sass": {
|
||||||
"version": "1.23.3",
|
"version": "1.23.3",
|
||||||
|
@ -53,7 +53,7 @@
|
|||||||
"ngx-file-drop": "^8.0.8",
|
"ngx-file-drop": "^8.0.8",
|
||||||
"ngx-markdown": "^9.0.0",
|
"ngx-markdown": "^9.0.0",
|
||||||
"rxjs": "~6.5.4",
|
"rxjs": "~6.5.4",
|
||||||
"sartography-workflow-lib": "^0.0.177",
|
"sartography-workflow-lib": "^0.0.180",
|
||||||
"tslib": "^1.11.1",
|
"tslib": "^1.11.1",
|
||||||
"uuid": "^7.0.2",
|
"uuid": "^7.0.2",
|
||||||
"zone.js": "^0.10.3"
|
"zone.js": "^0.10.3"
|
||||||
|
@ -23,6 +23,7 @@ import {FormlyModule} from '@ngx-formly/core';
|
|||||||
import {
|
import {
|
||||||
AppEnvironment,
|
AppEnvironment,
|
||||||
AuthInterceptor,
|
AuthInterceptor,
|
||||||
|
ErrorInterceptor,
|
||||||
SartographyFormsModule,
|
SartographyFormsModule,
|
||||||
SartographyPipesModule,
|
SartographyPipesModule,
|
||||||
SartographyWorkflowLibModule
|
SartographyWorkflowLibModule
|
||||||
@ -46,12 +47,12 @@ import {FooterComponent} from './footer/footer.component';
|
|||||||
import {HomeComponent} from './home/home.component';
|
import {HomeComponent} from './home/home.component';
|
||||||
import {ModelerComponent} from './modeler/modeler.component';
|
import {ModelerComponent} from './modeler/modeler.component';
|
||||||
import {NavbarComponent} from './navbar/navbar.component';
|
import {NavbarComponent} from './navbar/navbar.component';
|
||||||
|
import {ProtocolBuilderComponent} from './protocol-builder/protocol-builder.component';
|
||||||
|
import {ReferenceFilesComponent} from './reference-files/reference-files.component';
|
||||||
import {SignInComponent} from './sign-in/sign-in.component';
|
import {SignInComponent} from './sign-in/sign-in.component';
|
||||||
import {SignOutComponent} from './sign-out/sign-out.component';
|
import {SignOutComponent} from './sign-out/sign-out.component';
|
||||||
import {WorkflowSpecCardComponent} from './workflow-spec-card/workflow-spec-card.component';
|
import {WorkflowSpecCardComponent} from './workflow-spec-card/workflow-spec-card.component';
|
||||||
import {WorkflowSpecListComponent} from './workflow-spec-list/workflow-spec-list.component';
|
import {WorkflowSpecListComponent} from './workflow-spec-list/workflow-spec-list.component';
|
||||||
import { ProtocolBuilderComponent } from './protocol-builder/protocol-builder.component';
|
|
||||||
import { ReferenceFilesComponent } from './reference-files/reference-files.component';
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ThisEnvironment implements AppEnvironment {
|
export class ThisEnvironment implements AppEnvironment {
|
||||||
@ -131,6 +132,7 @@ export class ThisEnvironment implements AppEnvironment {
|
|||||||
{provide: 'APP_ENVIRONMENT', useClass: ThisEnvironment},
|
{provide: 'APP_ENVIRONMENT', useClass: ThisEnvironment},
|
||||||
{provide: APP_BASE_HREF, useValue: environment.baseHref},
|
{provide: APP_BASE_HREF, useValue: environment.baseHref},
|
||||||
{provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true},
|
{provide: HTTP_INTERCEPTORS, useClass: AuthInterceptor, multi: true},
|
||||||
|
{provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AppModule {
|
export class AppModule {
|
||||||
|
@ -39,14 +39,6 @@ export class NavbarComponent {
|
|||||||
this._loadNavLinks();
|
this._loadNavLinks();
|
||||||
}, error => {
|
}, error => {
|
||||||
localStorage.removeItem('token');
|
localStorage.removeItem('token');
|
||||||
|
|
||||||
if (this.environment.production) {
|
|
||||||
localStorage.setItem('prev_url', location.href);
|
|
||||||
const emptyUserParams: UserParams = { uid: null };
|
|
||||||
this.api.redirectToLogin(location.origin + '/session', emptyUserParams);
|
|
||||||
} else {
|
|
||||||
this.api.openUrl('/');
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,9 @@ export class SignInComponent implements OnInit {
|
|||||||
|
|
||||||
// For testing purposes, create a user to simulate login.
|
// For testing purposes, create a user to simulate login.
|
||||||
if (!this.environment.production) {
|
if (!this.environment.production) {
|
||||||
localStorage.setItem('prev_url', location.href);
|
localStorage.setItem('prev_url', location.origin);
|
||||||
this.api.redirectToLogin(location.origin + '/session', this.model);
|
this.model.redirect_url = location.origin + '/session';
|
||||||
|
this.api.redirectToLogin(this.model.redirect_url, this.model);
|
||||||
} else {
|
} else {
|
||||||
this.error = new Error('This feature does not work in production.');
|
this.error = new Error('This feature does not work in production.');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user