Skip to content

Conversation

sywhb
Copy link
Contributor

@sywhb sywhb commented Aug 30, 2024

No description provided.

Copy link

vercel bot commented Aug 30, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
omnivore-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 8:57am
omnivore-prod ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 30, 2024 8:57am

@vercel vercel bot temporarily deployed to Preview – omnivore-demo August 30, 2024 08:57 Inactive
@vercel vercel bot temporarily deployed to Preview – omnivore-prod August 30, 2024 08:57 Inactive

try {
// Make a GET request to the /export endpoint
const response = await fetch('/api/export', {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if they click this multiple times?

Copy link
Contributor Author

@sywhb sywhb Aug 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two cases:

  1. If the export task is running, clicking this multiple times won't create multiple tasks and just return 200. Probably we should return 202 instead
  2. If the export tasks is failed/completed, clicking this multiple times will firstly check if the user has exceed the export quota(3 times in a day)
    2a. if not exceed, create a new export task
    2b. if exceed, failed and return 400

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great!

Is there any way in API to get the status of the export?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we can reuse the same export API by providing different status code like 200 or 204. Alternatively there is a /task/{{id}} API which could be used to query the status of a task

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think probably I will just reuse the /export API and use the status code and state in the response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants