SHARE
TWEET

Untitled

a guest Sep 16th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top