MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / onSearch

Function onSearch

frontend/src/widgets/instance/mod-manager/useModSearch.ts:90–117  ·  view source on GitHub ↗
(page: any = 1, limit: any = null)

Source from the content-addressed store, hash-verified

88 };
89
90 const onSearch = async (page: any = 1, limit: any = null) => {
91 if (typeof page !== "number") page = 1;
92 if (limit && typeof limit === "number") searchLimit.value = limit;
93 searchLoading.value = true;
94 searched.value = true;
95 searchPage.value = page;
96 try {
97 const { execute } = searchModsApi();
98 const res = await execute({
99 params: {
100 query: searchFilters.value.query,
101 source: searchFilters.value.source,
102 version: searchFilters.value.version,
103 type: searchFilters.value.type,
104 loader: searchFilters.value.loader,
105 environment: searchFilters.value.environment,
106 offset: (page - 1) * searchLimit.value,
107 limit: searchLimit.value
108 }
109 });
110 searchResults.value = res.value?.hits || [];
111 searchTotal.value = res.value?.total_hits || 0;
112 } catch (err: any) {
113 message.error(err.message);
114 } finally {
115 searchLoading.value = false;
116 }
117 };
118
119 const formatDate = (d: string) => {
120 if (!d) return t("TXT_CODE_UNKNOWN_TIME");

Callers

nothing calls this directly

Calls 2

executeFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected