refac
This commit is contained in:
1 parent
a5c9459401
commit
c7e634776d
2 files changed
+9
-10
No files matched your search
@@ -161,9 +161,7 @@
|
|||||||
{:else}
|
{:else}
|
||||||
<div class="text-left text-sm w-full max-h-[28rem] overflow-y-auto space-y-0.5">
|
<div class="text-left text-sm w-full max-h-[28rem] overflow-y-auto space-y-0.5">
|
||||||
{#each sortedMemories as memory (memory.id)}
|
{#each sortedMemories as memory (memory.id)}
|
||||||
<div
|
<div class="group w-full flex justify-between items-center text-sm py-1 px-1">
|
||||||
class="group w-full flex justify-between items-center text-sm py-1 px-1"
|
|
||||||
>
|
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
class="flex-1 min-w-0 text-left flex items-center gap-1.5 pr-2 text-gray-900 dark:text-gray-100 hover:text-black dark:hover:text-white transition leading-5"
|
class="flex-1 min-w-0 text-left flex items-center gap-1.5 pr-2 text-gray-900 dark:text-gray-100 hover:text-black dark:hover:text-white transition leading-5"
|
||||||
@@ -172,9 +170,7 @@
|
|||||||
<div class="truncate leading-5">
|
<div class="truncate leading-5">
|
||||||
{memory.content}
|
{memory.content}
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span class="shrink-0 text-[11px] leading-5 text-gray-400 dark:text-gray-500">
|
||||||
class="shrink-0 text-[11px] leading-5 text-gray-400 dark:text-gray-500"
|
|
||||||
>
|
|
||||||
{memoryTypeLabel(memory)}
|
{memoryTypeLabel(memory)}
|
||||||
</span>
|
</span>
|
||||||
{#if memory.path}
|
{#if memory.path}
|
||||||
|
|||||||
@@ -30,16 +30,19 @@
|
|||||||
const submitHandler = async () => {
|
const submitHandler = async () => {
|
||||||
loading = true;
|
loading = true;
|
||||||
|
|
||||||
const res = await (edit
|
const res = await (
|
||||||
? updateMemoryById(localStorage.token, memory.id, content, type, path)
|
edit
|
||||||
: addNewMemory(localStorage.token, content, type, path)
|
? updateMemoryById(localStorage.token, memory.id, content, type, path)
|
||||||
|
: addNewMemory(localStorage.token, content, type, path)
|
||||||
).catch((error) => {
|
).catch((error) => {
|
||||||
toast.error(`${error}`);
|
toast.error(`${error}`);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
toast.success(edit ? $i18n.t('Memory updated successfully') : $i18n.t('Memory added successfully'));
|
toast.success(
|
||||||
|
edit ? $i18n.t('Memory updated successfully') : $i18n.t('Memory added successfully')
|
||||||
|
);
|
||||||
show = false;
|
show = false;
|
||||||
dispatch('save');
|
dispatch('save');
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user