fix the direct upload class example

This commit is contained in:
Indigo Tech 2024-05-23 11:54:46 -05:00
parent 43e4916483
commit 3855416df8
1 changed files with 4 additions and 4 deletions

View File

@ -1302,10 +1302,10 @@ import { DirectUpload } from "@rails/activestorage"
class Uploader {
constructor(file, url) {
this.upload = new DirectUpload(this.file, this.url, this)
this.upload = new DirectUpload(file, url, this)
}
upload(file) {
uploadFile(file) {
this.upload.create((error, blob) => {
if (error) {
// Handle the error
@ -1342,10 +1342,10 @@ class Uploader {
const headers = { 'Authentication': `Bearer ${token}` }
// INFO: Sending headers is an optional parameter. If you choose not to send headers,
// authentication will be performed using cookies or session data.
this.upload = new DirectUpload(this.file, this.url, this, headers)
this.upload = new DirectUpload(file, url, this, headers)
}
upload(file) {
uploadFile(file) {
this.upload.create((error, blob) => {
if (error) {
// Handle the error