From 011761c5603e7275a20a2597f9f0b03c18c7d0fd Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 21 Jan 2021 20:00:29 +0800 Subject: chore: Fix crlf. --- FrontEnd/src/app/http/search.ts | 96 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 48 deletions(-) (limited to 'FrontEnd/src/app/http') diff --git a/FrontEnd/src/app/http/search.ts b/FrontEnd/src/app/http/search.ts index 8ff1c499..2da9295e 100644 --- a/FrontEnd/src/app/http/search.ts +++ b/FrontEnd/src/app/http/search.ts @@ -1,48 +1,48 @@ -import { - apiBaseUrl, - axios, - convertToNetworkError, - extractResponseData, -} from "./common"; -import { - HttpTimelineInfo, - processRawTimelineInfo, - RawHttpTimelineInfo, -} from "./timeline"; -import { HttpUser } from "./user"; - -export interface IHttpSearchClient { - searchTimelines(query: string): Promise; - searchUsers(query: string): Promise; -} - -export class HttpSearchClient implements IHttpSearchClient { - searchTimelines(query: string): Promise { - return axios - .get(`${apiBaseUrl}/search/timelines?q=${query}`) - .then(extractResponseData) - .then((ts) => ts.map(processRawTimelineInfo)) - .catch(convertToNetworkError); - } - - searchUsers(query: string): Promise { - return axios - .get(`${apiBaseUrl}/search/users?q=${query}`) - .then(extractResponseData) - .catch(convertToNetworkError); - } -} - -let client: IHttpSearchClient = new HttpSearchClient(); - -export function getHttpSearchClient(): IHttpSearchClient { - return client; -} - -export function setHttpSearchClient( - newClient: IHttpSearchClient -): IHttpSearchClient { - const old = client; - client = newClient; - return old; -} +import { + apiBaseUrl, + axios, + convertToNetworkError, + extractResponseData, +} from "./common"; +import { + HttpTimelineInfo, + processRawTimelineInfo, + RawHttpTimelineInfo, +} from "./timeline"; +import { HttpUser } from "./user"; + +export interface IHttpSearchClient { + searchTimelines(query: string): Promise; + searchUsers(query: string): Promise; +} + +export class HttpSearchClient implements IHttpSearchClient { + searchTimelines(query: string): Promise { + return axios + .get(`${apiBaseUrl}/search/timelines?q=${query}`) + .then(extractResponseData) + .then((ts) => ts.map(processRawTimelineInfo)) + .catch(convertToNetworkError); + } + + searchUsers(query: string): Promise { + return axios + .get(`${apiBaseUrl}/search/users?q=${query}`) + .then(extractResponseData) + .catch(convertToNetworkError); + } +} + +let client: IHttpSearchClient = new HttpSearchClient(); + +export function getHttpSearchClient(): IHttpSearchClient { + return client; +} + +export function setHttpSearchClient( + newClient: IHttpSearchClient +): IHttpSearchClient { + const old = client; + client = newClient; + return old; +} -- cgit v1.2.3