fix: prompt import

This commit is contained in:
Timothy Jaeryang Baek 2024-12-24 15:32:23 -07:00
parent 364d6eb9c4
commit e1a198f0a3
2 changed files with 10 additions and 7 deletions

View File

@ -4,7 +4,7 @@ type PromptItem = {
command: string;
title: string;
content: string;
access_control: null | object;
access_control?: null | object;
};
export const createNewPrompt = async (token: string, prompt: PromptItem) => {

View File

@ -239,12 +239,12 @@
console.log(savedPrompts);
for (const prompt of savedPrompts) {
await createNewPrompt(
localStorage.token,
await createNewPrompt(localStorage.token, {
command:
prompt.command.charAt(0) === '/' ? prompt.command.slice(1) : prompt.command,
prompt.title,
prompt.content
).catch((error) => {
title: prompt.title,
content: prompt.content
}).catch((error) => {
toast.error(error);
return null;
});
@ -252,6 +252,9 @@
prompts = await getPromptList(localStorage.token);
await _prompts.set(await getPrompts(localStorage.token));
importFiles = [];
promptsImportInputElement.value = '';
};
reader.readAsText(importFiles[0]);