This commit is contained in:
Daniel Shleifman
2021-06-17 03:28:22 +03:00
parent 3930c26715
commit fd6e227b4f
8 changed files with 107 additions and 47 deletions

View File

@@ -1,3 +1,7 @@
import axios from 'axios'
import { torrentsHost } from './Hosts'
export function humanizeSize(size) {
if (!size) return ''
const i = Math.floor(Math.log(size) / Math.log(1024))
@@ -41,3 +45,12 @@ export const removeRedundantCharacters = string => {
return hasThreeDotsAtTheEnd ? `${trimmedString}..` : trimmedString
}
export const getTorrents = async () => {
try {
const { data } = await axios.post(torrentsHost(), { action: 'list' })
return data
} catch (error) {
throw new Error(null)
}
}