refac
This commit is contained in:
@@ -1,12 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
import { prompts } from '$lib/stores';
|
||||
import { onMount, getContext } from 'svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { getPromptById, getPrompts, updatePromptById } from '$lib/apis/prompts';
|
||||
import { getPromptById, updatePromptById } from '$lib/apis/prompts';
|
||||
import { page } from '$app/stores';
|
||||
|
||||
import PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
|
||||
@@ -26,7 +25,6 @@
|
||||
|
||||
if (updatedPrompt) {
|
||||
toast.success($i18n.t('Prompt updated successfully'));
|
||||
await prompts.set(await getPrompts(localStorage.token));
|
||||
// Update local prompt state to reflect the new version
|
||||
prompt = {
|
||||
id: updatedPrompt.id,
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { goto } from '$app/navigation';
|
||||
import { prompts } from '$lib/stores';
|
||||
import { onMount, tick, getContext } from 'svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
import { createNewPrompt, getPrompts } from '$lib/apis/prompts';
|
||||
import { createNewPrompt } from '$lib/apis/prompts';
|
||||
import PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
|
||||
|
||||
let prompt: {
|
||||
@@ -27,8 +26,6 @@
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t('Prompt created successfully'));
|
||||
|
||||
await prompts.set(await getPrompts(localStorage.token));
|
||||
await goto('/workspace/prompts');
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user