mirror of
https://github.com/filecoin-project/slate.git
synced 2024-11-28 23:12:32 +03:00
23 lines
549 B
JavaScript
23 lines
549 B
JavaScript
import * as Strings from "~/common/strings";
|
|
import * as Data from "~/node_common/data";
|
|
|
|
export default async (req, res) => {
|
|
if (Strings.isEmpty(req.query.query)) {
|
|
return {
|
|
decorator: "SERVER_SEARCH_NO_QUERY",
|
|
data: { results: [] },
|
|
};
|
|
}
|
|
|
|
const { query } = req.query;
|
|
const users = await Data.queryUsers({ query });
|
|
const slates = await Data.querySlates({ query });
|
|
|
|
let results = [...users, ...slates];
|
|
|
|
return res.status(200).send({
|
|
decorator: "SERVER_SEARCH_QUERY",
|
|
data: { query, results },
|
|
});
|
|
};
|