mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-26 03:47:40 -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 {
|
return {
|
||||||
host: host,
|
host: host,
|
||||||
showing: false,
|
showing: false,
|
||||||
searching: false,
|
|
||||||
accounts: [],
|
accounts: [],
|
||||||
connection: null,
|
connection: null,
|
||||||
menuDef: sidebarDef,
|
menuDef: sidebarDef,
|
||||||
|
@ -125,19 +124,7 @@ export default defineComponent({
|
||||||
},
|
},
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
if (this.searching) return;
|
search();
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async openAccountMenu(ev) {
|
async openAccountMenu(ev) {
|
||||||
|
|
|
@ -97,8 +97,8 @@ export function apiWithDialog(
|
||||||
|
|
||||||
export function promiseDialog<T extends Promise<any>>(
|
export function promiseDialog<T extends Promise<any>>(
|
||||||
promise: T,
|
promise: T,
|
||||||
onSuccess?: (res: any) => void,
|
onSuccess?: ((res: any) => void) | null,
|
||||||
onFailure?: (e: Error) => void,
|
onFailure?: ((e: Error) => void) | null,
|
||||||
text?: string,
|
text?: string,
|
||||||
): T {
|
): T {
|
||||||
const showing = ref(true);
|
const showing = ref(true);
|
||||||
|
|
|
@ -3,19 +3,14 @@ import * as os from '@/os';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
import { router } from '@/router';
|
import { router } from '@/router';
|
||||||
|
|
||||||
export async function search(q?: string | null | undefined) {
|
export async function search() {
|
||||||
if (q == null) {
|
const { canceled, result: query } = await os.dialog({
|
||||||
const { canceled, result: query } = await os.dialog({
|
title: i18n.locale.search,
|
||||||
title: i18n.locale.search,
|
input: true
|
||||||
input: true
|
});
|
||||||
});
|
if (canceled || query == null || query === '') return;
|
||||||
|
|
||||||
if (canceled || query == null || query === '') return;
|
const q = query.trim();
|
||||||
|
|
||||||
q = query;
|
|
||||||
}
|
|
||||||
|
|
||||||
q = q.trim();
|
|
||||||
|
|
||||||
if (q.startsWith('@') && !q.includes(' ')) {
|
if (q.startsWith('@') && !q.includes(' ')) {
|
||||||
router.push(`/${q}`);
|
router.push(`/${q}`);
|
||||||
|
@ -39,7 +34,8 @@ export async function search(q?: string | null | undefined) {
|
||||||
date.setHours(23, 59, 59, 999);
|
date.setHours(23, 59, 59, 999);
|
||||||
}
|
}
|
||||||
|
|
||||||
v.$root.$emit('warp', date);
|
// TODO
|
||||||
|
//v.$root.$emit('warp', date);
|
||||||
os.dialog({
|
os.dialog({
|
||||||
icon: faHistory,
|
icon: faHistory,
|
||||||
iconOnly: true, autoClose: true
|
iconOnly: true, autoClose: true
|
||||||
|
|
Loading…
Reference in a new issue