비효율적인 디렉터리 페이지 자동 갱신 구현

This commit is contained in:
static
2025-01-07 00:09:32 +09:00
parent 6c4bd590f0
commit 1cabc5f7b3
4 changed files with 13 additions and 2 deletions

View File

@@ -37,13 +37,16 @@
const createDirectory = async (name: string) => {
await requestDirectoryCreation(name, data.id, $masterKeyStore?.get(1)!);
isCreateDirectoryModalOpen = false;
info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME
};
const uploadFile = () => {
const file = fileInput?.files?.[0];
if (!file) return;
requestFileUpload(file, data.id, $masterKeyStore?.get(1)!);
requestFileUpload(file, data.id, $masterKeyStore?.get(1)!).then(() => {
info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME
});
};
$effect(() => {
@@ -114,6 +117,7 @@
bind:selectedEntry
onRenameClick={async (newName) => {
await requestDirectoryEntryRename(selectedEntry!, newName);
info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME
return true;
}}
/>
@@ -122,6 +126,7 @@
bind:selectedEntry
onDeleteClick={async () => {
await requestDirectoryEntryDeletion(selectedEntry!);
info = getDirectoryInfo(data.id, $masterKeyStore?.get(1)?.key!); // TODO: FIXME
return true;
}}
/>

View File

@@ -29,7 +29,7 @@ export const requestDirectoryCreation = async (
) => {
const { dataKey, dataKeyVersion } = await generateDataKey();
const nameEncrypted = await encryptData(new TextEncoder().encode(name), dataKey);
return await callPostApi<DirectoryCreateRequest>("/api/directory/create", {
await callPostApi<DirectoryCreateRequest>("/api/directory/create", {
parentId,
mekVersion: masterKey.version,
dek: await wrapDataKey(dataKey, masterKey.key),

View File

@@ -12,6 +12,9 @@ const config = {
// If your environment is not supported, or you settled on a specific environment, switch out the adapter.
// See https://svelte.dev/docs/kit/adapters for more information about adapters.
adapter: adapter(),
csrf: {
checkOrigin: false,
},
},
};

View File

@@ -9,4 +9,7 @@ export default defineConfig({
compiler: "svelte",
}),
],
server: {
host: true,
},
});