question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

add alternative way of adding actions

See original GitHub issue

I’m planning to add a very simple way of adding actions as string.

At the moment actions can be added like this:

const store = new Vapi({
  baseURL: 'https://foobar.com',
  /*...*/
})
.get({
  property: 'post',
  action: 'getPost',
  path: ({id}) => `posts/${id}`
})

The alternative version I’m looking forward to looks like this:

const store = new Vapi({
  baseURL: 'https://foobar.com',
  /*...*/
})
.add('GET posts/:id INTO post AS getPost')

Or maybe like this:

const store = new Vapi({
  baseURL: 'https://foobar.com',
  /*...*/
})
.add("get", ({ id }) => `posts/${id}`, "post", "getPost")

One nice side effect would be that you didn’t have to write the path function if it’s that easy. The params will be detected (e.g. :id) and automatically added.

Please consider: This is just a draft. I’ll maybe change the syntax or did overlook some problems.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
christianmalekcommented, Oct 12, 2018

@slurmulon Thanks for your input! I agree with all of your arguments. If someone really wants to have a “simpler” approach he/she could write an helper method to please his needs. =)

// without helper
.get({
  property: 'post',
  action: 'getPost',
  path: ({id}) => `posts/${id}`
})

// with helper (just an example)
.get(helper("post", "getPost", ({id}) => `posts/${id}`))
1reaction
slurmuloncommented, Oct 12, 2018

I wrote a detailed comment on this proposed change in a less relevant issue (whoops!):

https://github.com/christianmalek/vuex-rest-api/issues/54#issuecomment-429187894

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do I add actions to Photoshop? - website builder
Another way to add actions is to use the keyboard. You can hold down the Option (Alt) key and type “A” to open...
Read more >
Customize actions on your messages in Outlook.com
Go to the type of actions you want to add. Select the check boxes for the actions you want. They'll appear in the...
Read more >
How To Install Photoshop Actions - Greater Than Gatsby
From the drop-down menu, select “Load Actions”. Navigate back to where you saved the actions and select the file ending in “. atn”....
Read more >
Adding New Actions or Workflows - Junxure Support
To continue or add on to a Workflow, navigate to the Action Card you want to continue from. Use the More menu and...
Read more >
How to Use Photoshop Actions and New Conditional Actions
In this tutorial you will learn how to Use Actions and New Conditional Actions. Actions are automated chain of commands that are executed ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found