client: fix issue of search only working once

closes FoundKeyGang/FoundKey#274

Changelog: Fixed
This commit is contained in:
Johann150 2022-12-07 21:55:39 +01:00
parent b66f7550ab
commit 501cf834c8
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -55,7 +55,7 @@
</template>
<script lang="ts" setup>
import { computed, watch } from 'vue';
import { computed, nextTick, watch } from 'vue';
import XNotes from '@/components/notes.vue';
import XUserList from '@/components/user-list.vue';
import MkButton from '@/components/ui/button.vue';
@ -115,6 +115,9 @@ function selectUser() {
}
async function search(): void {
userPagination = null;
notePagination = null;
switch (tab) {
case 'all': {
query = query.trim();
@ -138,6 +141,7 @@ async function search(): void {
mainRouter.push(`/notes/${res.object.id}`);
}
} else {
nextTick(() => {
notePagination = {
endpoint: 'notes/search' as const,
limit: 10,
@ -152,6 +156,7 @@ async function search(): void {
origin,
},
};
});
}
break;
}
@ -171,16 +176,17 @@ async function search(): void {
params.host = host;
break;
}
nextTick(() => {
notePagination = {
endpoint: 'notes/search' as const,
limit: 10,
params,
};
userPagination = null;
});
break;
}
case 'users': {
notePagination = null;
nextTick(() => {
userPagination = {
endpoint: 'users/search' as const,
limit: 10,
@ -189,6 +195,7 @@ async function search(): void {
origin,
},
};
});
break;
}
}