troyanskiy / ngx-resource-core

RESTful Core Library
40 stars 10 forks source link

IResourceMethodPromiseStrict returns observable instead of promise #50

Closed trinopoty closed 5 years ago

trinopoty commented 5 years ago

I recently updated to the latest version of the library and noticed this issue. I've changed all my IResourceMethodStrict to IResourceMethodPromiseStrict but it returns an Observable instead of a Promise. As such, I'm getting errors like .then is not a function.

troyanskiy commented 5 years ago

Hi! Add somewhere at app initialisation to make it work globally

ResourceGlobalConfig.returnAs = ResourceActionReturnType.Promise

Suggest to put that in app.component constructor

trinopoty commented 5 years ago

But this is still a bug. returnAs should not be overriding IResourceMethodPromiseStrict. If I specified a IResourceMethodPromiseStrict, it should return a promise and not anything else.

troyanskiy commented 5 years ago

IResourceMethodPromiseStrict is just an Interface which is used in order to tell your IDE that it should return promise

trinopoty commented 5 years ago

I see.