Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. interface Actions {
  2. item: ItemAction;
  3. }
  4.  
  5. export function createActions<K extends keyof Actions>(
  6. endpoint: string,
  7. url: string,
  8. actions: K[],
  9. ): Pick<Actions, K> {
  10. const res = {};
  11. if (actions.includes('item')) {
  12. res['item'] = {
  13. path: `${url}/:id`,
  14. endpoint: {
  15. endpoint: `${endpoint}:id/`,
  16. method: 'GET',
  17. },
  18. }
  19. }
  20. return res;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement