list_vendors is added
This commit is contained in:
parent
72569d064f
commit
4b87710878
|
@ -31,6 +31,8 @@ import { MemberLevelModule } from 'app/modules/polyglot/member_level/member_leve
|
||||||
import { MemberModule } from 'app/modules/polyglot/member/member.module';
|
import { MemberModule } from 'app/modules/polyglot/member/member.module';
|
||||||
import { SiteModule } from 'app/modules/polyglot/site/site.module';
|
import { SiteModule } from 'app/modules/polyglot/site/site.module';
|
||||||
|
|
||||||
|
import { ApiModule } from 'app/modules/polyglot/api/api.module';
|
||||||
|
|
||||||
const routerConfig: ExtraOptions = {
|
const routerConfig: ExtraOptions = {
|
||||||
preloadingStrategy: PreloadAllModules,
|
preloadingStrategy: PreloadAllModules,
|
||||||
scrollPositionRestoration: 'enabled',
|
scrollPositionRestoration: 'enabled',
|
||||||
|
@ -70,6 +72,8 @@ const routerConfig: ExtraOptions = {
|
||||||
MemberLevelModule.forRoot(),
|
MemberLevelModule.forRoot(),
|
||||||
MemberModule.forRoot(),
|
MemberModule.forRoot(),
|
||||||
SiteModule.forRoot(),
|
SiteModule.forRoot(),
|
||||||
|
|
||||||
|
ApiModule.forRoot(),
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent],
|
bootstrap: [AppComponent],
|
||||||
})
|
})
|
||||||
|
|
|
@ -54,6 +54,7 @@ import {
|
||||||
ListMembersResponse,
|
ListMembersResponse,
|
||||||
} from 'app/modules/proto/c2se/member_pb';
|
} from 'app/modules/proto/c2se/member_pb';
|
||||||
import { Pagination } from 'app/modules/proto/protobuf/pagination_pb';
|
import { Pagination } from 'app/modules/proto/protobuf/pagination_pb';
|
||||||
|
import { ApiService } from 'app/modules/polyglot/api/services/api.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'partner-list',
|
selector: 'partner-list',
|
||||||
templateUrl: './list.component.html',
|
templateUrl: './list.component.html',
|
||||||
|
@ -119,6 +120,7 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
private _activatedRoute: ActivatedRoute,
|
private _activatedRoute: ActivatedRoute,
|
||||||
private _partnerService: PartnerService,
|
private _partnerService: PartnerService,
|
||||||
private __memberService: MemberService,
|
private __memberService: MemberService,
|
||||||
|
private __apiService: ApiService,
|
||||||
|
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private _matDialog: MatDialog
|
private _matDialog: MatDialog
|
||||||
|
@ -190,6 +192,15 @@ export class ListComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||||
// Mark for check
|
// Mark for check
|
||||||
this._changeDetectorRef.markForCheck();
|
this._changeDetectorRef.markForCheck();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.__apiService
|
||||||
|
.listBanks()
|
||||||
|
.then((l) => {
|
||||||
|
console.log('list', l.getVendorsList());
|
||||||
|
})
|
||||||
|
.catch((e) => {
|
||||||
|
console.log('error', e);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
16
src/app/modules/polyglot/api/api.module.ts
Normal file
16
src/app/modules/polyglot/api/api.module.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { ModuleWithProviders, NgModule } from '@angular/core';
|
||||||
|
|
||||||
|
import { SERVICES } from './services';
|
||||||
|
|
||||||
|
@NgModule({})
|
||||||
|
export class ApiRootModule {}
|
||||||
|
|
||||||
|
@NgModule({})
|
||||||
|
export class ApiModule {
|
||||||
|
public static forRoot(): ModuleWithProviders<ApiRootModule> {
|
||||||
|
return {
|
||||||
|
ngModule: ApiRootModule,
|
||||||
|
providers: [...SERVICES],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
49
src/app/modules/polyglot/api/services/api.service.ts
Normal file
49
src/app/modules/polyglot/api/services/api.service.ts
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { NatsService } from 'app/core/nats/services/nats.service';
|
||||||
|
|
||||||
|
import { Error } from 'app/modules/proto/protobuf/rpc_pb';
|
||||||
|
|
||||||
|
import {
|
||||||
|
ListVendorsRequest,
|
||||||
|
ListVendorsResponse,
|
||||||
|
} from 'app/modules/proto/c2se/api/vendor_pb';
|
||||||
|
import { SUBJECT_LIST_VENDORS } from 'app/modules/proto/c2se/backend/api/vendor_pb';
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root',
|
||||||
|
})
|
||||||
|
export class ApiService {
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
constructor(private __natsService: NatsService) {}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Accessors
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
// @ Public methods
|
||||||
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
listBanks(): Promise<ListVendorsResponse.Result> {
|
||||||
|
return new Promise<ListVendorsResponse.Result>((resolve, reject) => {
|
||||||
|
let req = new ListVendorsRequest();
|
||||||
|
|
||||||
|
this.__natsService
|
||||||
|
.request<ListVendorsResponse.Result>(
|
||||||
|
SUBJECT_LIST_VENDORS,
|
||||||
|
req.serializeBinary(),
|
||||||
|
ListVendorsResponse.deserializeBinary
|
||||||
|
)
|
||||||
|
.then((result) => {
|
||||||
|
console.log('success', result, result.getVendorsList());
|
||||||
|
return resolve(result);
|
||||||
|
})
|
||||||
|
.catch((e: Error) => {
|
||||||
|
console.log('failed', e);
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
5
src/app/modules/polyglot/api/services/index.ts
Normal file
5
src/app/modules/polyglot/api/services/index.ts
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
import { Type } from '@angular/core';
|
||||||
|
|
||||||
|
import { ApiService } from './api.service';
|
||||||
|
|
||||||
|
export const SERVICES: Type<any>[] = [ApiService];
|
Loading…
Reference in New Issue
Block a user