6
6
fetchSubscriptionHealth as getSubscriptionHealth ,
7
7
fetchSubscriptionLastUndeliveredMessage as getSubscriptionLastUndeliveredMessage ,
8
8
fetchSubscriptionMetrics as getSubscriptionMetrics ,
9
+ getSubscriptionTrackingUrls ,
9
10
fetchSubscriptionUndeliveredMessages as getSubscriptionUndeliveredMessages ,
10
11
retransmitSubscriptionMessages ,
11
12
suspendSubscription as suspend ,
@@ -20,6 +21,7 @@ import type { SentMessageTrace } from '@/api/subscription-undelivered';
20
21
import type { Subscription } from '@/api/subscription' ;
21
22
import type { SubscriptionHealth } from '@/api/subscription-health' ;
22
23
import type { SubscriptionMetrics } from '@/api/subscription-metrics' ;
24
+ import type { TrackingUrl } from '@/api/tracking-url' ;
23
25
24
26
export interface UseSubscription {
25
27
subscription : Ref < Subscription | undefined > ;
@@ -28,6 +30,7 @@ export interface UseSubscription {
28
30
subscriptionHealth : Ref < SubscriptionHealth | undefined > ;
29
31
subscriptionUndeliveredMessages : Ref < SentMessageTrace [ ] | null > ;
30
32
subscriptionLastUndeliveredMessage : Ref < SentMessageTrace | null > ;
33
+ trackingUrls : Ref < TrackingUrl [ ] | undefined > ;
31
34
loading : Ref < boolean > ;
32
35
error : Ref < UseSubscriptionsErrors > ;
33
36
removeSubscription : ( ) => Promise < boolean > ;
@@ -44,6 +47,7 @@ export interface UseSubscriptionsErrors {
44
47
fetchSubscriptionHealth : Error | null ;
45
48
fetchSubscriptionUndeliveredMessages : Error | null ;
46
49
fetchSubscriptionLastUndeliveredMessage : Error | null ;
50
+ getSubscriptionTrackingUrls : Error | null ;
47
51
}
48
52
49
53
export function useSubscription (
@@ -58,6 +62,7 @@ export function useSubscription(
58
62
const subscriptionHealth = ref < SubscriptionHealth > ( ) ;
59
63
const subscriptionUndeliveredMessages = ref < SentMessageTrace [ ] > ( [ ] ) ;
60
64
const subscriptionLastUndeliveredMessage = ref < SentMessageTrace | null > ( null ) ;
65
+ const trackingUrls = ref < TrackingUrl [ ] > ( ) ;
61
66
const loading = ref ( false ) ;
62
67
const error = ref < UseSubscriptionsErrors > ( {
63
68
fetchSubscription : null ,
@@ -66,6 +71,7 @@ export function useSubscription(
66
71
fetchSubscriptionHealth : null ,
67
72
fetchSubscriptionUndeliveredMessages : null ,
68
73
fetchSubscriptionLastUndeliveredMessage : null ,
74
+ getSubscriptionTrackingUrls : null ,
69
75
} ) ;
70
76
71
77
const fetchSubscription = async ( ) => {
@@ -150,6 +156,16 @@ export function useSubscription(
150
156
}
151
157
} ;
152
158
159
+ const fetchSubscriptionTrackingUrls = async ( ) => {
160
+ try {
161
+ trackingUrls . value = (
162
+ await getSubscriptionTrackingUrls ( topicName , subscriptionName )
163
+ ) . data ;
164
+ } catch ( e ) {
165
+ error . value . getSubscriptionTrackingUrls = e as Error ;
166
+ }
167
+ } ;
168
+
153
169
const removeSubscription = async ( ) : Promise < boolean > => {
154
170
try {
155
171
await deleteSubscription ( topicName , subscriptionName ) ;
@@ -278,6 +294,7 @@ export function useSubscription(
278
294
} ;
279
295
280
296
fetchSubscription ( ) ;
297
+ fetchSubscriptionTrackingUrls ( ) ;
281
298
282
299
return {
283
300
subscription,
@@ -286,6 +303,7 @@ export function useSubscription(
286
303
subscriptionHealth,
287
304
subscriptionUndeliveredMessages,
288
305
subscriptionLastUndeliveredMessage,
306
+ trackingUrls,
289
307
loading,
290
308
error,
291
309
removeSubscription,
0 commit comments