Skip to content

Commit f47e9cc

Browse files
authored
Merge pull request #1048 from p-andrey/master
add Authorization token to Dropzone.options.uploadForm only if it is present in the url
2 parents 38e304f + 0cb8014 commit f47e9cc

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
@@ -292,12 +292,16 @@
292292
}
293293
});
294294
},
295-
headers: {
296-
'Authorization': 'Bearer ' + getUrlParam('token')
297-
},
298295
acceptedFiles: "{{ implode(',', $helper->availableMimeTypes()) }}",
299296
maxFilesize: ({{ $helper->maxUploadSize() }} / 1000)
300297
}
298+
299+
var token = getUrlParam('token');
300+
if (token !== null) {
301+
Dropzone.options.uploadForm.headers = {
302+
'Authorization': 'Bearer ' + token
303+
};
304+
}
301305
</script>
302306
</body>
303307
</html>

0 commit comments

Comments
 (0)