Remove deprecated search API

This commit is contained in:
Manav 2023-02-10 17:23:19 +05:30
parent 02b059b5c4
commit a8e24b10c6

View file

@ -1,14 +1,10 @@
import * as chrono from 'chrono-node'; import * as chrono from 'chrono-node';
import { getEndpoint } from 'utils/common/apiUtil';
import { getToken } from 'utils/common/key';
import HTTPService from './HTTPService';
import { getAllPeople } from 'utils/machineLearning'; import { getAllPeople } from 'utils/machineLearning';
import constants from 'utils/strings/constants'; import constants from 'utils/strings/constants';
import mlIDbStorage from 'utils/storage/mlIDbStorage'; import mlIDbStorage from 'utils/storage/mlIDbStorage';
import { getMLSyncConfig } from 'utils/machineLearning/config'; import { getMLSyncConfig } from 'utils/machineLearning/config';
import { Collection } from 'types/collection'; import { Collection } from 'types/collection';
import { EnteFile } from 'types/file'; import { EnteFile } from 'types/file';
import { logError } from 'utils/sentry'; import { logError } from 'utils/sentry';
import { import {
Bbox, Bbox,
@ -26,8 +22,7 @@ import { Person, Thing } from 'types/machineLearning';
import { getUniqueFiles } from 'utils/file'; import { getUniqueFiles } from 'utils/file';
import { User } from 'types/user'; import { User } from 'types/user';
import { getData, LS_KEYS } from 'utils/storage/localStorage'; import { getData, LS_KEYS } from 'utils/storage/localStorage';
import { addLogLine } from 'utils/logging';
const ENDPOINT = getEndpoint();
const DIGITS = new Set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']); const DIGITS = new Set(['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']);
@ -294,23 +289,10 @@ function parseHumanDate(humanDate: string): DateValue[] {
} }
async function searchLocation( async function searchLocation(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
searchPhrase: string searchPhrase: string
): Promise<LocationSearchResponse[]> { ): Promise<LocationSearchResponse[]> {
try { addLogLine(`attempting to use unimplemented search API`);
const resp = await HTTPService.get(
`${ENDPOINT}/search/location`,
{
query: searchPhrase,
limit: 4,
},
{
'X-Auth-Token': getToken(),
}
);
return resp.data.results ?? [];
} catch (e) {
logError(e, 'location search failed');
}
return []; return [];
} }