forked from FoundKeyGang/FoundKey
client: fix issue of search only working once
closes FoundKeyGang/FoundKey#274 Changelog: Fixed
This commit is contained in:
parent
b66f7550ab
commit
501cf834c8
1 changed files with 37 additions and 30 deletions
|
@ -55,7 +55,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, watch } from 'vue';
|
import { computed, nextTick, watch } from 'vue';
|
||||||
import XNotes from '@/components/notes.vue';
|
import XNotes from '@/components/notes.vue';
|
||||||
import XUserList from '@/components/user-list.vue';
|
import XUserList from '@/components/user-list.vue';
|
||||||
import MkButton from '@/components/ui/button.vue';
|
import MkButton from '@/components/ui/button.vue';
|
||||||
|
@ -115,6 +115,9 @@ function selectUser() {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function search(): void {
|
async function search(): void {
|
||||||
|
userPagination = null;
|
||||||
|
notePagination = null;
|
||||||
|
|
||||||
switch (tab) {
|
switch (tab) {
|
||||||
case 'all': {
|
case 'all': {
|
||||||
query = query.trim();
|
query = query.trim();
|
||||||
|
@ -138,20 +141,22 @@ async function search(): void {
|
||||||
mainRouter.push(`/notes/${res.object.id}`);
|
mainRouter.push(`/notes/${res.object.id}`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
notePagination = {
|
nextTick(() => {
|
||||||
endpoint: 'notes/search' as const,
|
notePagination = {
|
||||||
limit: 10,
|
endpoint: 'notes/search' as const,
|
||||||
params: { query },
|
limit: 10,
|
||||||
};
|
params: { query },
|
||||||
origin = 'combined';
|
};
|
||||||
userPagination = {
|
origin = 'combined';
|
||||||
endpoint: 'users/search' as const,
|
userPagination = {
|
||||||
limit: 4,
|
endpoint: 'users/search' as const,
|
||||||
params: {
|
limit: 4,
|
||||||
query,
|
params: {
|
||||||
origin,
|
query,
|
||||||
},
|
origin,
|
||||||
};
|
},
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -171,24 +176,26 @@ async function search(): void {
|
||||||
params.host = host;
|
params.host = host;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
notePagination = {
|
nextTick(() => {
|
||||||
endpoint: 'notes/search' as const,
|
notePagination = {
|
||||||
limit: 10,
|
endpoint: 'notes/search' as const,
|
||||||
params,
|
limit: 10,
|
||||||
};
|
params,
|
||||||
userPagination = null;
|
};
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'users': {
|
case 'users': {
|
||||||
notePagination = null;
|
nextTick(() => {
|
||||||
userPagination = {
|
userPagination = {
|
||||||
endpoint: 'users/search' as const,
|
endpoint: 'users/search' as const,
|
||||||
limit: 10,
|
limit: 10,
|
||||||
params: {
|
params: {
|
||||||
query,
|
query,
|
||||||
origin,
|
origin,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue