mirror of
https://github.com/kmc7468/arkvault.git
synced 2026-02-04 16:16:55 +00:00
디렉터리 페이지에서의 네트워크 호출 최적화
This commit is contained in:
@@ -14,8 +14,7 @@ import { trpc } from "$trpc/client";
|
||||
export interface SelectedEntry {
|
||||
type: "directory" | "file";
|
||||
id: number;
|
||||
dataKey: CryptoKey;
|
||||
dataKeyVersion: Date;
|
||||
dataKey: { key: CryptoKey; version: Date } | undefined;
|
||||
name: string;
|
||||
}
|
||||
|
||||
@@ -97,20 +96,26 @@ export const requestFileUpload = async (
|
||||
};
|
||||
|
||||
export const requestEntryRename = async (entry: SelectedEntry, newName: string) => {
|
||||
const newNameEncrypted = await encryptString(newName, entry.dataKey);
|
||||
if (!entry.dataKey) {
|
||||
// TODO: Error Handling
|
||||
console.log("hi");
|
||||
return false;
|
||||
}
|
||||
|
||||
const newNameEncrypted = await encryptString(newName, entry.dataKey.key);
|
||||
|
||||
try {
|
||||
if (entry.type === "directory") {
|
||||
await trpc().directory.rename.mutate({
|
||||
id: entry.id,
|
||||
dekVersion: entry.dataKeyVersion,
|
||||
dekVersion: entry.dataKey.version,
|
||||
name: newNameEncrypted.ciphertext,
|
||||
nameIv: newNameEncrypted.iv,
|
||||
});
|
||||
} else {
|
||||
await trpc().file.rename.mutate({
|
||||
id: entry.id,
|
||||
dekVersion: entry.dataKeyVersion,
|
||||
dekVersion: entry.dataKey.version,
|
||||
name: newNameEncrypted.ciphertext,
|
||||
nameIv: newNameEncrypted.iv,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user