Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface Actions {
- item: ItemAction;
- }
- export function createActions<K extends keyof Actions>(
- endpoint: string,
- url: string,
- actions: K[],
- ): Pick<Actions, K> {
- const res = {};
- if (actions.includes('item')) {
- res['item'] = {
- path: `${url}/:id`,
- endpoint: {
- endpoint: `${endpoint}:id/`,
- method: 'GET',
- },
- }
- }
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement