You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
741 B
28 lines
741 B
import { Injectable } from '@angular/core';
|
|
import { Action } from './action.types';
|
|
import {SessionService} from './session.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class ActionsService {
|
|
constructor(
|
|
protected readonly session: SessionService,
|
|
) { }
|
|
|
|
async perform(action: Action) {
|
|
if ( action.type === 'redirect' ) {
|
|
let destination = action.args.destination;
|
|
if ( action.args.appUrl ) {
|
|
destination = this.session.buildAppUrl(destination);
|
|
}
|
|
|
|
if ( action.args.blank ) {
|
|
window.open(destination, '_blank');
|
|
} else {
|
|
window.location.href = destination;
|
|
}
|
|
}
|
|
}
|
|
}
|