40 lines
691 B
JavaScript
40 lines
691 B
JavaScript
import { configureAxios, request } from "../requests"
|
|
|
|
import { addAlertOk } from "./alerts"
|
|
|
|
export function addTorrent(url) {
|
|
return request(
|
|
"ADD_TORRENT",
|
|
configureAxios().post("/torrents", {
|
|
url: url,
|
|
}),
|
|
[
|
|
addAlertOk("Torrent added"),
|
|
],
|
|
)
|
|
}
|
|
|
|
export function removeTorrent(id) {
|
|
return request(
|
|
"REMOVE_TORRENT",
|
|
configureAxios().delete(`/torrents/${id}`),
|
|
[
|
|
() => fetchTorrents(),
|
|
]
|
|
)
|
|
}
|
|
|
|
export function fetchTorrents() {
|
|
return request(
|
|
"TORRENTS_FETCH",
|
|
configureAxios().get("/torrents")
|
|
)
|
|
}
|
|
|
|
export function searchTorrents(url) {
|
|
return request(
|
|
"TORRENTS_SEARCH",
|
|
configureAxios().get(url)
|
|
)
|
|
}
|