เพิ่มระบบค้นหา issue

This commit is contained in:
Net 2024-02-16 16:20:19 +07:00
parent 289e655495
commit 3c5d0aee27
3 changed files with 27 additions and 1 deletions

View file

@ -82,6 +82,11 @@ const onLoad = (async (_: any, done: any) => {
outlined
label="ค้นหาข้อความ..."
v-model="searchInput"
@keydown.enter.prevent="
() => {
store.searchIssue(searchInput);
}
"
>
<template v-slot:prepend>
<q-icon name="search" />

View file

@ -200,7 +200,24 @@ export const useSupportStore = defineStore("supportServiceStore", () => {
if (res && res.data) {
issue.value = res.data;
currentPageIssue.value = res.data.page;
currentTotalIssue.value = res.data.total;
}
}
async function searchIssue(input: string) {
showLoader();
const res = await http
.get(config.API.supportSearchIssue(input))
.catch((err) => {
messageError($q, err);
})
.finally(() => {
hideLoader();
});
if (res && res.data) {
issue.value = res.data;
currentPageIssue.value = res.data.page;
currentTotalIssue.value = res.data.total;
}
@ -305,5 +322,6 @@ export const useSupportStore = defineStore("supportServiceStore", () => {
fetchCategory,
deleteCategory,
editCategory,
searchIssue,
};
});