فهرست منبع

refac: prompts frontend

Timothy Jaeryang Baek 5 ماه پیش
والد
کامیت
e78657f07e

+ 5 - 1
src/routes/(app)/workspace/prompts/create/+page.svelte

@@ -1,9 +1,11 @@
-<script>
+<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 PromptEditor from '$lib/components/workspace/Prompts/PromptEditor.svelte';
 
@@ -15,6 +17,8 @@
 		});
 
 		if (prompt) {
+			toast.success($i18n.t('Prompt created successfully'));
+
 			await prompts.set(await getPrompts(localStorage.token));
 			await goto('/workspace/prompts');
 		}

+ 4 - 1
src/routes/(app)/workspace/prompts/edit/+page.svelte

@@ -1,9 +1,11 @@
-<script>
+<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 { getPromptByCommand, getPrompts, updatePromptByCommand } from '$lib/apis/prompts';
 	import { page } from '$app/stores';
 
@@ -18,6 +20,7 @@
 		});
 
 		if (prompt) {
+			toast.success($i18n.t('Prompt updated successfully'));
 			await prompts.set(await getPrompts(localStorage.token));
 			await goto('/workspace/prompts');
 		}