Skip to content

Commit

Permalink
Simplify search.vue (remove dead code) (#10088)
Browse files Browse the repository at this point in the history
* Simplify search.vue

This is already handled by the code above it, no need to handle it twice

* Remove unused imports
  • Loading branch information
SoniEx2 authored Feb 26, 2023
1 parent 209d8b4 commit dbd9d11
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions packages/frontend/src/pages/search.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import * as os from '@/os';
import { useRouter, mainRouter } from '@/router';
import { $i } from '@/account';
const router = useRouter();
Expand Down Expand Up @@ -116,24 +115,6 @@ const search = async () => {
return;
}
if ($i != null) {
if (query.startsWith('https://') || (query.startsWith('@') && !query.includes(' '))) {
const promise = os.api('ap/show', {
uri: query,
});
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
const res = await promise;
if (res.type === 'User') {
router.replace(`/@${res.object.username}@${res.object.host}`);
} else if (res.type === 'Note') {
router.replace(`/notes/${res.object.id}`);
}
}
}
window.history.replaceState('', '', `/search?q=${encodeURIComponent(query)}&type=${searchType}${searchType === 'user' ? `&origin=${searchOrigin}` : ''}`);
};
Expand Down

0 comments on commit dbd9d11

Please sign in to comment.