@@ -7,10 +7,9 @@ import { NewSubscriptionRequest } from '../components/subscription-list/new-subs
7
7
providedIn : 'root'
8
8
} )
9
9
export class PubsubService {
10
- project_id = "test-project"
11
10
public currentHost = "http://localhost:8681"
12
11
13
- private _projectList = new BehaviorSubject < string [ ] > ( [ "test-project" ] )
12
+ private _projectList = new BehaviorSubject < string [ ] > ( [ ] )
14
13
private _currentProject = new ReplaySubject < string > ( )
15
14
private _currentTopic = new ReplaySubject < Topic > ( )
16
15
private _currentSubscription = new ReplaySubject < Subscription > ( )
@@ -39,14 +38,14 @@ export class PubsubService {
39
38
this . _projectList . next ( newList )
40
39
}
41
40
42
- createTopic ( projectId : string = this . project_id , topicId : string ) {
41
+ createTopic ( projectId : string , topicId : string ) {
43
42
const url = `${ this . currentHost } /v1/projects/${ projectId } /topics/${ topicId } `
44
43
45
44
return this . http . put < Topic > ( url , { } )
46
45
}
47
46
48
- listTopics ( projectId : string = this . project_id ) {
49
- return this . http . get < { topics : Topic [ ] } > ( `${ this . currentHost } /v1/projects/${ this . project_id } /topics` ) . pipe ( map ( incoming => incoming ?. topics || [ ] ) )
47
+ listTopics ( projectId : string ) {
48
+ return this . http . get < { topics : Topic [ ] } > ( `${ this . currentHost } /v1/projects/${ projectId } /topics` ) . pipe ( map ( incoming => incoming ?. topics || [ ] ) )
50
49
}
51
50
52
51
createSubscription ( projectId : string , request : NewSubscriptionRequest ) {
@@ -60,8 +59,8 @@ export class PubsubService {
60
59
return this . http . delete ( url )
61
60
}
62
61
63
- listSubscriptions ( ) : Observable < Subscription [ ] > {
64
- return this . http . get < { subscriptions ?: string [ ] } > ( `${ this . currentHost } /v1/projects/${ this . project_id } /subscriptions` )
62
+ listSubscriptions ( projectId : string ) : Observable < Subscription [ ] > {
63
+ return this . http . get < { subscriptions ?: string [ ] } > ( `${ this . currentHost } /v1/projects/${ projectId } /subscriptions` )
65
64
. pipe (
66
65
map ( incoming => incoming . subscriptions ) , // first we pull out the subscriptions object
67
66
map ( subNames => subNames ?? [ ] ) ,
0 commit comments