-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Rewrite Ticker View to TypeScript (#272)
* ♻️ Rewrite Ticker View to TypeScript
- Loading branch information
Showing
15 changed files
with
596 additions
and
692 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { ApiUrl, Response } from './Api' | ||
import AuthSingleton from '../components/AuthService' | ||
|
||
const Auth = AuthSingleton.getInstance() | ||
|
||
interface MessagesResponseData { | ||
messages: Array<Message> | ||
} | ||
|
||
interface MessageResponseData { | ||
message: Message | ||
} | ||
|
||
export interface Message { | ||
id: number | ||
ticker: number | ||
text: string | ||
creation_date: Date | ||
tweet_id: string | ||
tweet_user: string | ||
geo_information: string | ||
// TODO | ||
attachments: any[] | ||
} | ||
|
||
export function getMessages( | ||
ticker: number | ||
): Promise<Response<MessagesResponseData>> { | ||
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages`) | ||
} | ||
|
||
// TODO: any | ||
export function postMessage( | ||
ticker: string, | ||
text: string, | ||
geoInformation: any, | ||
attachments: any[] | ||
): Promise<Response<MessageResponseData>> { | ||
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages`, { | ||
body: JSON.stringify({ | ||
text: text, | ||
geo_information: geoInformation, | ||
attachments: attachments, | ||
}), | ||
method: 'POST', | ||
}) | ||
} | ||
|
||
export function deleteMessage( | ||
ticker: string, | ||
message: string | ||
): Promise<Response<any>> { | ||
return Auth.fetch(`${ApiUrl}/admin/tickers/${ticker}/messages/${message}`, { | ||
method: 'DELETE', | ||
}) | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.