`ResourceCrud` does not always respect global `path`
marshall007 opened this issue · 1 comments
marshall007 commented
@ResourceParams({
path: '/sources',
url: env.URL,
})
export class SourceResource extends ResourceCRUD<{}, ISource, ISource> { }
const sources = new SourceResource();
sources.query(); // -> GET /sources
sources.get({ id: 'foo' }); // -> GET /foo
Workaround is to just include the path
in the url
:
@ResourceParams({
url: `${env.URL}/sources`,
})
export class SourceResource extends ResourceCRUD<{}, ISource, ISource> { }
sources.get({ id: 'foo' }); // -> GET /sources/foo
troyanskiy commented
Hello.
Yes, because the resource crud methods already have there's path.
Not a lot time ago I have added new param pathPrefix which is solving your case.
Simply use like that:
@ResourceParams({
url: env.URL,
pathPrefix: '/sources'
})
export class SourceResource extends ResourceCRUD<{}, ISource, ISource> { }
I will close the issue.
Feel free to create new with other questions or proposals.