token service

parent 10feabc8
......@@ -19,16 +19,10 @@
<div *ngIf="clipboardText; else copied">{{'global.copy_to_clipboard' | translate}}</div>
<ng-template #copied>{{'global.copied' | translate}}</ng-template>
</button>
<!--<button type="button" class="btn btn-primary" >Zwischenablage</button>-->
<a href="{{'global.mail' | translate}}{{bonusToken}}.">
<button class="btn btn-primary" >
{{'global.mail_to' | translate}}
</button>
</a>
<!--<button type="button" class="btn btn-primary">Email</button>-->
</div>
import {Component} from '@angular/core';
import {NgbActiveModal} from '@ng-bootstrap/ng-bootstrap';
import {BonusTokenService} from '../../../../../service/user/shared/bonus-token.service';
import {BonusTokenService} from 'src/app/service/user/shared/bonus-token.service';
@Component({
selector: 'app-user-token',
......
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {UserService} from '../../user/user.service';
import {DefaultSettings} from '../../../lib/default.settings';
@Injectable({
providedIn: 'root'
......@@ -6,8 +9,20 @@ import {Injectable} from '@angular/core';
export class BonusTokenService {
public bonusToken: string;
constructor() {
constructor(private http: HttpClient, private userService: UserService) {
this.bonusToken = 'afsml8';
http.request('GET', `${DefaultSettings.httpApiEndpoint}/member/bonustoken`, {
headers: {authorization: this.userService.staticLoginToken},
observe: 'body',
responseType: 'text',
withCredentials: true
}).subscribe(
nextResult => {
this.bonusToken = nextResult;
},
err => console.error('Observer got an error: ' + err),
() => console.log('Observer got a complete notification')
);
}
public getToken(): string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment