feat: File rename API done.
This commit is contained in:
@@ -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 = '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user