mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
rename option
This commit is contained in:
@@ -103,7 +103,7 @@ export default defineComponent({
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
replaceWithId: {
|
||||
fileId: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
@@ -164,7 +164,7 @@ export default defineComponent({
|
||||
progress.value = Math.round(percentage.reduce((acc, cur) => (acc += cur)) / files.length);
|
||||
done.value = percentage.filter((p) => p === 100).length;
|
||||
},
|
||||
replaceWithId: props.replaceWithId,
|
||||
fileId: props.fileId,
|
||||
preset: props.preset,
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<v-card v-if="file">
|
||||
<v-card-title>{{ $t('replace_file') }}</v-card-title>
|
||||
<v-card-text>
|
||||
<v-upload :preset="preset" :replace-with-id="file.id" @input="uploaded" from-url />
|
||||
<v-upload :preset="preset" :file-id="file.id" @input="uploaded" from-url />
|
||||
</v-card-text>
|
||||
<v-card-actions>
|
||||
<v-button secondary @click="$emit('toggle', false)">{{ $t('done') }}</v-button>
|
||||
|
||||
@@ -11,7 +11,7 @@ export default async function uploadFile(
|
||||
onProgressChange?: (percentage: number) => void;
|
||||
notifications?: boolean;
|
||||
preset?: Record<string, any>;
|
||||
replaceWithId?: string;
|
||||
fileId?: string;
|
||||
}
|
||||
) {
|
||||
const progressHandler = options?.onProgressChange || (() => undefined);
|
||||
@@ -28,8 +28,8 @@ export default async function uploadFile(
|
||||
try {
|
||||
let response = null;
|
||||
|
||||
if (options?.replaceWithId !== undefined) {
|
||||
response = await api.patch(`/files/${options.replaceWithId}`, formData, {
|
||||
if (options?.fileId !== undefined) {
|
||||
response = await api.patch(`/files/${options.fileId}`, formData, {
|
||||
onUploadProgress,
|
||||
});
|
||||
} else {
|
||||
|
||||
@@ -8,7 +8,7 @@ export default async function uploadFiles(
|
||||
onProgressChange?: (percentages: number[]) => void;
|
||||
notifications?: boolean;
|
||||
preset?: Record<string, any>;
|
||||
replaceWithId?: string;
|
||||
fileId?: string;
|
||||
}
|
||||
) {
|
||||
const progressHandler = options?.onProgressChange || (() => undefined);
|
||||
@@ -23,7 +23,7 @@ export default async function uploadFiles(
|
||||
progressForFiles[index] = percentage;
|
||||
progressHandler(progressForFiles);
|
||||
},
|
||||
replaceWithId: index === 0 ? options?.replaceWithId : undefined,
|
||||
fileId: index === 0 ? options?.fileId : undefined,
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user