mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-09 02:24:18 +00:00
fix spectrum model
This commit is contained in:
parent
b6280b59df
commit
ad846881fd
@ -1,20 +1,36 @@
|
||||
import axios from "axios"
|
||||
import SessionService from "../session"
|
||||
//import User from "comty.js/models/user"
|
||||
|
||||
async function injectUserData(list) {
|
||||
if (!Array.isArray(list)) {
|
||||
return list
|
||||
}
|
||||
|
||||
const user_ids = list.map((item) => {
|
||||
return item.user_id
|
||||
})
|
||||
|
||||
//const users = await User.data(user_ids.join(","))
|
||||
|
||||
return list
|
||||
}
|
||||
|
||||
export default class Streaming {
|
||||
static apiHostname = process.env.NODE_ENV === "production" ? "https://live.ragestudio.net" : "https://fr01.ragestudio.net:8035"
|
||||
static apiHostname = "https://live.ragestudio.net"
|
||||
|
||||
static get base() {
|
||||
const baseInstance = axios.create({
|
||||
baseURL: Streaming.apiHostname,
|
||||
headers: {
|
||||
"Accept": "application/json",
|
||||
"ngrok-skip-browser-warning": "any"
|
||||
}
|
||||
Accept: "application/json",
|
||||
"ngrok-skip-browser-warning": "any",
|
||||
},
|
||||
})
|
||||
|
||||
if (SessionService.token) {
|
||||
baseInstance.defaults.headers.common["Authorization"] = `Bearer ${SessionService.token}`
|
||||
baseInstance.defaults.headers.common["Authorization"] =
|
||||
`Bearer ${SessionService.token}`
|
||||
}
|
||||
|
||||
return baseInstance
|
||||
@ -27,7 +43,7 @@ export default class Streaming {
|
||||
|
||||
return {
|
||||
...data,
|
||||
hostname: Streaming.apiHostname
|
||||
hostname: Streaming.apiHostname,
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,4 +109,28 @@ export default class Streaming {
|
||||
console.warn("getConnectionStatus() | Not implemented")
|
||||
return false
|
||||
}
|
||||
|
||||
static async getLivestreamsList({ limit, offset } = {}) {
|
||||
let { data } = await Streaming.base({
|
||||
method: "get",
|
||||
url: "/streaming/list",
|
||||
params: {
|
||||
limit,
|
||||
offset,
|
||||
},
|
||||
})
|
||||
|
||||
data = await injectUserData(data)
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
static async getLivestreamData(livestream_id) {
|
||||
const { data } = await Streaming.base({
|
||||
method: "get",
|
||||
url: `/streaming/${livestream_id}`,
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user