Created
August 13, 2017 18:59
-
-
Save erika-dike/405a98d6972c53a2ae87876db320d16c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const cloudinary = global.cloudinary; | |
| export default function openCloudinaryUploadWidget() { | |
| return new Promise((resolve, reject) => { | |
| cloudinary.openUploadWidget({ | |
| cloud_name: process.env.REACT_APP_CLOUDINARY_CLOUD_NAME, | |
| upload_preset: process.env.REACT_APP_CLOUDINARY_UPLOAD_PRESET, | |
| tags: ['profile_pic'], | |
| }, (error, result) => { | |
| if (result) { | |
| resolve(result[0].secure_url); | |
| } else if (error) { | |
| reject(error.message); | |
| } | |
| }); | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment