|
1 | 1 | import { Component, Input, OnInit, inject } from '@angular/core';
|
2 | 2 | import { EMPTY, firstValueFrom, map, Observable } from 'rxjs';
|
3 | 3 | import { PubsubService, ReceivedMessage, Subscription } from 'src/app/services/pubsub.service';
|
4 |
| -import { AsyncPipe, DatePipe } from '@angular/common'; |
| 4 | +import { AsyncPipe, DatePipe, JsonPipe } from '@angular/common'; |
5 | 5 | import { MatButton } from '@angular/material/button';
|
6 | 6 | import { MatIcon } from '@angular/material/icon';
|
7 | 7 | import { MatSuffix } from '@angular/material/form-field';
|
8 | 8 |
|
9 | 9 | @Component({
|
10 |
| - selector: 'app-subscription-details', |
11 |
| - templateUrl: './subscription-details.component.html', |
12 |
| - styleUrls: ['./subscription-details.component.scss'], |
13 |
| - standalone: true, |
14 |
| - imports: [MatButton, MatIcon, MatSuffix, AsyncPipe, DatePipe] |
| 10 | + selector: 'app-subscription-details', |
| 11 | + templateUrl: './subscription-details.component.html', |
| 12 | + styleUrls: ['./subscription-details.component.scss'], |
| 13 | + standalone: true, |
| 14 | + imports: [MatButton, MatIcon, MatSuffix, AsyncPipe, DatePipe, JsonPipe] |
15 | 15 | })
|
16 | 16 | export class SubscriptionDetailsComponent implements OnInit {
|
17 | 17 | private pubsub = inject(PubsubService);
|
@@ -50,11 +50,11 @@ export class SubscriptionDetailsComponent implements OnInit {
|
50 | 50 | console.log('called with', data)
|
51 | 51 | }
|
52 | 52 |
|
53 |
| - async ackMessage(ackId: string){ |
| 53 | + async ackMessage(ackId: string) { |
54 | 54 | const result = await firstValueFrom(this.pubsub.ackMessage(this.subscriptionPath!, [ackId]))
|
55 | 55 | console.log("result", result)
|
56 |
| - |
57 |
| - if(Object.keys(result).length == 0){ // a valid response will be no content |
| 56 | + |
| 57 | + if (Object.keys(result).length == 0) { // a valid response will be no content |
58 | 58 | this.messages = this.messages.filter(msg => msg.ackId != ackId)
|
59 | 59 | }
|
60 | 60 | }
|
|
0 commit comments