hardlounge/client/js/commands/search.js

32 lines
607 B
JavaScript
Raw Normal View History

"use strict";
import store from "../store";
import {router} from "../router";
function input(args) {
if (!store.state.settings.searchEnabled) {
2021-07-07 22:12:28 +00:00
const disabled = "Search is currently not enabled.";
store.commit("currentUserVisibleError", disabled);
setTimeout(
() =>
store.state.currentUserVisibleError === disabled &&
store.commit("currentUserVisibleError", null),
5000
);
} else {
router.push({
name: "SearchResults",
params: {
id: store.state.activeChannel.channel.id,
},
query: {
q: args.join(" "),
},
});
}
return true;
}
export default {input};