Skip to content

Commit 0cb8014

Browse files
committed
add Authorization token to Dropzone uploadForm only if it present in url
1 parent 7f07972 commit 0cb8014

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/views/index.blade.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,16 @@
281281
}
282282
});
283283
},
284-
headers: {
285-
'Authorization': 'Bearer ' + getUrlParam('token')
286-
},
287284
acceptedFiles: "{{ implode(',', $helper->availableMimeTypes()) }}",
288285
maxFilesize: ({{ $helper->maxUploadSize() }} / 1000)
289286
}
287+
288+
var token = getUrlParam('token');
289+
if (token !== null) {
290+
Dropzone.options.uploadForm.headers = {
291+
'Authorization': 'Bearer ' + token
292+
};
293+
}
290294
</script>
291295
</body>
292296
</html>

0 commit comments

Comments
 (0)