@@ -7,10 +7,9 @@ import { NewSubscriptionRequest } from '../components/subscription-list/new-subs
77 providedIn : 'root'
88} )
99export class PubsubService {
10- project_id = "test-project"
1110 public currentHost = "http://localhost:8681"
1211
13- private _projectList = new BehaviorSubject < string [ ] > ( [ "test-project" ] )
12+ private _projectList = new BehaviorSubject < string [ ] > ( [ ] )
1413 private _currentProject = new ReplaySubject < string > ( )
1514 private _currentTopic = new ReplaySubject < Topic > ( )
1615 private _currentSubscription = new ReplaySubject < Subscription > ( )
@@ -39,14 +38,14 @@ export class PubsubService {
3938 this . _projectList . next ( newList )
4039 }
4140
42- createTopic ( projectId : string = this . project_id , topicId : string ) {
41+ createTopic ( projectId : string , topicId : string ) {
4342 const url = `${ this . currentHost } /v1/projects/${ projectId } /topics/${ topicId } `
4443
4544 return this . http . put < Topic > ( url , { } )
4645 }
4746
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 || [ ] ) )
5049 }
5150
5251 createSubscription ( projectId : string , request : NewSubscriptionRequest ) {
@@ -60,8 +59,8 @@ export class PubsubService {
6059 return this . http . delete ( url )
6160 }
6261
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` )
6564 . pipe (
6665 map ( incoming => incoming . subscriptions ) , // first we pull out the subscriptions object
6766 map ( subNames => subNames ?? [ ] ) ,
0 commit comments