This commit is contained in:
caf 2023-01-20 14:57:59 +04:00
parent 4e9084a632
commit d7265def88
3 changed files with 13 additions and 6 deletions

View File

@ -106,7 +106,10 @@
<th>
Обновлено:
</th>
<th>
<th *ngIf="terminal?.socket_data?.last_ping === null">
Нет Данных
</th>
<th *ngIf="!(terminal?.socket_data?.last_ping === null)">
{{terminal?.socket_data?.last_ping | date:'dd.MM.yy, HH:mm:ss'}}
</th>
</tr>
@ -114,7 +117,10 @@
<th>
Закрыто:
</th>
<th>
<th *ngIf="terminal?.socket_data?.closed === null">
Нет Данных
</th>
<th *ngIf="!(terminal?.socket_data?.closed === null)">
{{terminal?.socket_data?.closed ? 'Да' : 'Нет'}}
</th>
</tr>

View File

@ -100,7 +100,7 @@ export class TerminalsComponent implements OnInit {
await this.jsonRpcService.rpc({
method: 'getTerminal',
params: [this.choose, id]
}, RpcService.authService, false)
}, RpcService.authService, true)
.subscribe({
next: (result) => {
let data = result.result;

View File

@ -40,11 +40,12 @@ export class JsonrpcService {
private cookiesService: CookiesService
) { }
rpc(data: {method: string, params: any},service: RpcService, auth = false): Observable<any> {
rpc(data: {method: string, params: any}, service: RpcService, auth?: boolean): Observable<any> {
let headers = new HttpHeaders();
const token = decodeURI(this.cookiesService.getItem('token') ?? '');
console.log(token);
headers = headers.set('Content-Type', 'application/json');
auth ? headers.set('Authorization', token) : null;
auth ? headers = headers.append('Authorization', token) : null;
const options = {
headers: headers,
};