Commit 36162bd3 authored by Vladislav Bogac's avatar Vladislav Bogac

Revert "Alles funktioniert"

This reverts commit 480f522f
parent 69a66fcb
import { TestBed } from '@angular/core/testing';
import { BonusTokenService } from './bonus-token.service';
import {BonusTokenMockService} from './bonus-token.mock.service';
describe('BonusTokenService', () => {
let service: BonusTokenService;
......@@ -9,7 +10,8 @@ describe('BonusTokenService', () => {
TestBed.configureTestingModule({
providers: [
{
provide: BonusTokenService
provide: BonusTokenService,
useClass: BonusTokenMockService
}
]
});
......
import {Injectable} from '@angular/core';
import {HttpClient} from '@angular/common/http';
import {UserService} from '../user.service';
import {DefaultSettings} from '../../../lib/default.settings';
@Injectable({
providedIn: 'root'
})
export class BonusTokenService {
public bonusToken: string;
private configUrl: string;
constructor(private http: HttpClient) {
constructor(private http: HttpClient, private userService: UserService) {
this.bonusToken = 'afsml8';
this.configUrl = 'https://staging.arsnova.click/backend/api/v1/member/token';
this.http.get(this.configUrl).subscribe(data => {
this.bonusToken += data['status'];
});
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 {
return this.bonusToken;
}
}
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