Skip to content

Commit 63d5f75

Browse files
committed
feat: allow switching between local and s3 storage for image uploader
1 parent 8b7b765 commit 63d5f75

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/components/images/ImageUploader.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ export default {
8787
// TODO(akinsey): if ($scope.onDone) { $scope.onDone({data: url}); }
8888
if (props.purpose === 'avatar' || props.purpose === 'logo' || props.purpose === 'favicon') {
8989
v.model = url
90-
emit('upload-success', 'http://localhost:8080' + url)
90+
91+
let imageRoot = image.policy.storageType === 'local' ? window.images_local_root : ''
92+
emit('upload-success', imageRoot + url)
9193
}
9294
else v.images.push(image)
9395
})

src/composables/services/image-upload.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ export const upload = image => {
6363
xhr.upload.addEventListener('error', deferred.reject, false)
6464

6565
// Send the file
66-
xhr.open('POST', 'http://localhost:8080' + url, true)
66+
let imageRoot = storageType === 'local' ? window.images_local_root : ''
67+
xhr.open('POST', imageRoot + url, true)
6768
if (storageType === 'local') {
6869
xhr.setRequestHeader('Authorization', 'Bearer ' + token)
6970
}

0 commit comments

Comments
 (0)