Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] CldUploadWidget Helper Functions #226

Closed
colbyfayock opened this issue Aug 7, 2024 · 1 comment · Fixed by #228
Closed

[Feature] CldUploadWidget Helper Functions #226

colbyfayock opened this issue Aug 7, 2024 · 1 comment · Fixed by #228
Labels
enhancement New feature or request

Comments

@colbyfayock
Copy link
Collaborator

Feature Request

Is your feature request related to a problem? Please describe.

Adopt new upload widget helper functions along with other front end frameworks that consume the URL Loader API.

Via cloudinary-community/cloudinary-util#166

Example implementation: cloudinary-community/next-cloudinary#492

Describe the solution you'd like

Usage:

import { generateSignatureCallback, generateUploadWidgetResultCallback, getUploadWidgetOptions, UPLOAD_WIDGET_EVENTS } from '@cloudinary-util/url-loader'

const signatureCallback = generateSignatureCallback({
  signatureEndpoint: '/asdf',
  fetch
})

const uploadOptions = getUploadWidgetOptions({
  signatureCallback
}, {
  cloud: {
    cloudName: 'testcloud',
    apiKey: 'abcd1234'
  }
});

const resultsCallback = generateUploadWidgetResultCallback({
  onError: (uploadError) => {
    // Example on storing error
    // setError(uploadError);
  },
  onResult: (uploadResult) => {
    // Example of storing results on any event
    // setResults(uploadResult);
  },
  onSuccess: (uploadResult) => {
    // Tapping into individual events
  }
});

cloudinary.createUploadWidget(uploadOptions, resultsCallback);

// UPLOAD_WIDGET_EVENTS can replace WIDGET_EVENTS manually managed in front end code
@colbyfayock colbyfayock added the enhancement New feature or request label Aug 7, 2024
@Baroshem Baroshem linked a pull request Aug 8, 2024 that will close this issue
6 tasks
@Baroshem
Copy link
Collaborator

Baroshem commented Aug 8, 2024

Hey, I have added this feature in #228 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants