Open arturo-switchboard opened 1 month ago
The current sample for custom file storage results in an Unhandled Runtime Error. https://docs.unlayer.com/docs/custom-file-storage
Ideally I would like to be able to do something like:
unlayer.registerCallback('image', function(file, done) { var data = new FormData() data.append('file', file.attachments[0]) fetch('/uploads', { method: 'POST', headers: { 'Accept': 'application/json' }, body: data }).then(response => { // Make sure the response was valid if (response.status >= 200 && response.status < 300) { return response } else { // Custom Logic on messaging (eg. toast) done({progress: 100}) } }).then(response => { return response.json() }).then(data => { // Pass the URL back to Unlayer to mark this upload as completed done({ progress: 100, url: data.filelink }) }) })
The current sample for custom file storage results in an Unhandled Runtime Error. https://docs.unlayer.com/docs/custom-file-storage
Ideally I would like to be able to do something like: