mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 09:57:29 -07:00
Fix search.ts
This commit is contained in:
parent
ce2980bbce
commit
d17acb3a70
3 changed files with 12 additions and 29 deletions
|
@ -59,7 +59,6 @@ export default defineComponent({
|
|||
return {
|
||||
host: host,
|
||||
showing: false,
|
||||
searching: false,
|
||||
accounts: [],
|
||||
connection: null,
|
||||
menuDef: sidebarDef,
|
||||
|
@ -125,19 +124,7 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
search() {
|
||||
if (this.searching) return;
|
||||
|
||||
os.dialog({
|
||||
title: this.$ts.search,
|
||||
input: true
|
||||
}).then(async ({ canceled, result: query }) => {
|
||||
if (canceled || query == null || query === '') return;
|
||||
|
||||
this.searching = true;
|
||||
search(this, query).finally(() => {
|
||||
this.searching = false;
|
||||
});
|
||||
});
|
||||
search();
|
||||
},
|
||||
|
||||
async openAccountMenu(ev) {
|
||||
|
|
|
@ -97,8 +97,8 @@ export function apiWithDialog(
|
|||
|
||||
export function promiseDialog<T extends Promise<any>>(
|
||||
promise: T,
|
||||
onSuccess?: (res: any) => void,
|
||||
onFailure?: (e: Error) => void,
|
||||
onSuccess?: ((res: any) => void) | null,
|
||||
onFailure?: ((e: Error) => void) | null,
|
||||
text?: string,
|
||||
): T {
|
||||
const showing = ref(true);
|
||||
|
|
|
@ -3,19 +3,14 @@ import * as os from '@/os';
|
|||
import { i18n } from '@/i18n';
|
||||
import { router } from '@/router';
|
||||
|
||||
export async function search(q?: string | null | undefined) {
|
||||
if (q == null) {
|
||||
const { canceled, result: query } = await os.dialog({
|
||||
title: i18n.locale.search,
|
||||
input: true
|
||||
});
|
||||
export async function search() {
|
||||
const { canceled, result: query } = await os.dialog({
|
||||
title: i18n.locale.search,
|
||||
input: true
|
||||
});
|
||||
if (canceled || query == null || query === '') return;
|
||||
|
||||
if (canceled || query == null || query === '') return;
|
||||
|
||||
q = query;
|
||||
}
|
||||
|
||||
q = q.trim();
|
||||
const q = query.trim();
|
||||
|
||||
if (q.startsWith('@') && !q.includes(' ')) {
|
||||
router.push(`/${q}`);
|
||||
|
@ -39,7 +34,8 @@ export async function search(q?: string | null | undefined) {
|
|||
date.setHours(23, 59, 59, 999);
|
||||
}
|
||||
|
||||
v.$root.$emit('warp', date);
|
||||
// TODO
|
||||
//v.$root.$emit('warp', date);
|
||||
os.dialog({
|
||||
icon: faHistory,
|
||||
iconOnly: true, autoClose: true
|
||||
|
|
Loading…
Reference in a new issue