Convert write.js to TS
parent
af06503351
commit
cfb1a60ac4
|
@ -1,13 +1,18 @@
|
|||
import {writeLineProtocol as writeLineProtocolAJAX} from 'src/data_explorer/apis'
|
||||
|
||||
import {notify} from 'shared/actions/notifications'
|
||||
import {notify} from 'src/shared/actions/notifications'
|
||||
import {Source} from 'src/types'
|
||||
|
||||
import {
|
||||
notifyDataWritten,
|
||||
notifyDataWriteFailed,
|
||||
} from 'shared/copy/notifications'
|
||||
} from 'src/shared/copy/notifications'
|
||||
|
||||
export const writeLineProtocolAsync = (source, db, data) => async dispatch => {
|
||||
export const writeLineProtocolAsync = (
|
||||
source: Source,
|
||||
db: string,
|
||||
data: string
|
||||
) => async (dispatch): Promise<void> => {
|
||||
try {
|
||||
await writeLineProtocolAJAX(source, db, data)
|
||||
dispatch(notify(notifyDataWritten()))
|
|
@ -1,8 +0,0 @@
|
|||
import AJAX from 'src/utils/ajax'
|
||||
|
||||
export const writeLineProtocol = async (source, db, data) =>
|
||||
await AJAX({
|
||||
url: `${source.links.write}?db=${db}`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
|
@ -0,0 +1,13 @@
|
|||
import AJAX from 'src/utils/ajax'
|
||||
import {Source} from 'src/types'
|
||||
|
||||
export const writeLineProtocol = async (
|
||||
source: Source,
|
||||
db: string,
|
||||
data: string
|
||||
): Promise<void> =>
|
||||
await AJAX({
|
||||
url: `${source.links.write}?db=${db}`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
|
@ -76,7 +76,7 @@ interface RequestParams {
|
|||
resource?: string | null
|
||||
id?: string | null
|
||||
method?: string
|
||||
data?: object
|
||||
data?: object | string
|
||||
params?: object
|
||||
headers?: object
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue