mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
refactor
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user