diff options
author | crupest <crupest@outlook.com> | 2022-04-11 22:59:41 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-04-11 22:59:41 +0800 |
commit | 9c0cb8f8d3944c813ef28ff9f736f148fd701a66 (patch) | |
tree | 69842e08eaf6d16a055d464d46ba435a188c8d39 /FrontEnd/src/http/highlight.ts | |
parent | 65210138df643a475632690e2fb20401c1edbb95 (diff) | |
download | timeline-9c0cb8f8d3944c813ef28ff9f736f148fd701a66.tar.gz timeline-9c0cb8f8d3944c813ef28ff9f736f148fd701a66.tar.bz2 timeline-9c0cb8f8d3944c813ef28ff9f736f148fd701a66.zip |
...
Diffstat (limited to 'FrontEnd/src/http/highlight.ts')
-rw-r--r-- | FrontEnd/src/http/highlight.ts | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/FrontEnd/src/http/highlight.ts b/FrontEnd/src/http/highlight.ts deleted file mode 100644 index fddf0729..00000000 --- a/FrontEnd/src/http/highlight.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { axios, apiBaseUrl, extractResponseData } from "./common"; - -import { HttpTimelineInfo } from "./timeline"; - -export interface HttpHighlightMoveRequest { - timeline: string; - newPosition: number; -} - -export interface IHttpHighlightClient { - list(): Promise<HttpTimelineInfo[]>; - put(timeline: string): Promise<void>; - delete(timeline: string): Promise<void>; - move(req: HttpHighlightMoveRequest): Promise<void>; -} - -export class HttpHighlightClient implements IHttpHighlightClient { - list(): Promise<HttpTimelineInfo[]> { - return axios - .get<HttpTimelineInfo[]>(`${apiBaseUrl}/highlights`) - .then(extractResponseData); - } - - put(timeline: string): Promise<void> { - return axios.put(`${apiBaseUrl}/highlights/${timeline}`).then(); - } - - delete(timeline: string): Promise<void> { - return axios.delete(`${apiBaseUrl}/highlights/${timeline}`).then(); - } - - move(req: HttpHighlightMoveRequest): Promise<void> { - return axios.post(`${apiBaseUrl}/highlightop/move`, req).then(); - } -} - -let client: IHttpHighlightClient = new HttpHighlightClient(); - -export function getHttpHighlightClient(): IHttpHighlightClient { - return client; -} - -export function setHttpHighlightClient( - newClient: IHttpHighlightClient -): IHttpHighlightClient { - const old = client; - client = newClient; - return old; -} |