upd: dashboard admin

Deskripsi
- edit upload ttd setting desa

No Issues
This commit is contained in:
2025-11-20 16:09:36 +08:00
parent 03715b7c98
commit d0ff675950
5 changed files with 96 additions and 25 deletions

View File

@@ -0,0 +1,12 @@
import { v4 as uuidv4 } from "uuid";
import { mimeToExtension } from "./mimetypeToExtension";
export function renameFile({ oldFile, newName }: { oldFile: File; newName: string }) {
const ext = mimeToExtension(oldFile.type)
const nameFix = newName == 'random' ? `${uuidv4()}.${ext}` : newName
return new File([oldFile], nameFix, {
type: oldFile.type,
lastModified: oldFile.lastModified,
});
}