perf(frontend): cache user lists
This commit is contained in:
parent
5f52b13325
commit
cabed6098d
4 changed files with 10 additions and 4 deletions
|
|
@ -24,6 +24,7 @@ import MkAvatars from '@/components/MkAvatars.vue';
|
|||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||
import { userListsCache } from '@/cache';
|
||||
|
||||
const pagingComponent = $shallowRef<InstanceType<typeof MkPagination>>();
|
||||
|
||||
|
|
@ -38,6 +39,7 @@ async function create() {
|
|||
});
|
||||
if (canceled) return;
|
||||
await os.apiWithDialog('users/lists/create', { name: name });
|
||||
userListsCache.delete();
|
||||
pagingComponent.reload();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
|
|||
import { i18n } from '@/i18n';
|
||||
import { userPage } from '@/filters/user';
|
||||
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
||||
import { userListsCache } from '@/cache';
|
||||
|
||||
const props = defineProps<{
|
||||
listId: string;
|
||||
|
|
@ -97,6 +98,8 @@ async function renameList() {
|
|||
name: name,
|
||||
});
|
||||
|
||||
userListsCache.delete();
|
||||
|
||||
list.name = name;
|
||||
}
|
||||
|
||||
|
|
@ -107,10 +110,10 @@ async function deleteList() {
|
|||
});
|
||||
if (canceled) return;
|
||||
|
||||
await os.api('users/lists/delete', {
|
||||
await os.apiWithDialog('users/lists/delete', {
|
||||
listId: list.id,
|
||||
});
|
||||
os.success();
|
||||
userListsCache.delete();
|
||||
mainRouter.push('/my/lists');
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue