feat: File rename API done.

This commit is contained in:
chiayin
2024-01-11 12:26:40 +08:00
parent 01d712e487
commit d4f0801ca1
4 changed files with 104 additions and 9 deletions

View File

@@ -287,3 +287,32 @@ export async function uploadloader() {
customClass: customClass,
})
};
/**
* Rename Modal
* @param { function } rename
*/
export async function renameModal(rename, type, id) {
let fileName = '';
const { value, isConfirmed } = await Swal.fire({
title: 'RENAME',
input: 'text',
inputPlaceholder: 'Enter File Name.',
inputValue: fileName,
inputValidator: value => {
if(!value) return 'You need to write something!';
fileName = value;
},
icon: 'info',
iconHtml: '<span class="material-symbols-outlined text-[58px]">edit_square</span>',
iconColor: '#0099FF',
reverseButtons: true,
confirmButtonColor: '#0099FF',
showCancelButton: '#94a3b8',
customClass: customClass,
});
// 改名成功
if(isConfirmed) await rename(type, id, value);
// 清空欄位
fileName = '';
}