Closed daniloff200 closed 5 years ago
Hi @daniloff200
You can use ResourceGlobalConfig.url
to set the URL globally
And params is better to specify with the call:
constructor(handler: ResourceHandler, public appConfig: Config) {
super(handler);
}
@ResourceAction({
// IResourceAction
method: ResourceRequestMethod.Get,
path: 'myservice/{!id}'
})
req1: IResourceMethod<{id: string}, IRetDataInterface>;
@ResourceAction({
// IResourceAction
method: ResourceRequestMethod.Get,
path: '/myservice2/{!id}/{!userId}'
})
req2: IResourceMethod<{id: string, userId: string | number}, IRetDataInterface2>;
Then in your code
const data = await this.<the resource>.req1({id: '12312'});
const data2 = await this.<the resource>.req2({id: 'asdasa', userId: 23423});
Thanks, that helped :) Forgot to close that!
hey @troyanskiy Probably, I missed that in docs, but, is there any way to set url or params with variables?
For example, here's my code:
I can replace
this.appConfig.url
with some hardcode url, but, this url can be changed in any moment, so, it's not a good idea.Thanks for any help and suggestions!