Skip to main content

SyncsnapUploadButton

SyncsnapUploadButton is an all-in-one component: a button that opens a dialog with a QR code. When the user clicks the button, a job is created and the QR code is shown; the hook then calls your backend’s wait endpoint (the server polls until the job completes or fails). When done, your onCompleted(job, result) runs with the server’s result.

Basic usage

Clicking the button creates a job, opens the dialog, and shows the QR code. When the user uploads from their phone, the server waits for completion and returns a result; your onCompleted(job, result) receives it (e.g. a custom payload from your server’s onCompleted callback or the presigned download URL).

Props

All useSyncsnapJob options are supported (e.g. createJobUrl, getJobUrl, getWaitForCompletionUrl, waitTimeoutMs, waitIntervalMs, onCompleted). In addition:

Callbacks

Pass the same callbacks as useSyncsnapJob:

Custom API paths

If your API is not under /api/syncsnap/job:

Wait timeout and interval

Defaults: server waits up to 2 minutes, polling every 2 seconds. Override as needed:

Building your own UI

If you prefer not to use the button + dialog, use SyncsnapQrCode and useSyncsnapJob to create jobs and show the QR code in your own layout.