mirror of
https://github.com/ragestudio/comty.js.git
synced 2025-06-09 02:24:18 +00:00
Add support for releaseData
with addons
This commit is contained in:
parent
8e26ab1008
commit
133a7c37da
@ -1,11 +1,39 @@
|
||||
import request from "../../../request"
|
||||
import processAddons from "../../../helpers/processWithAddons"
|
||||
import standartListMerge from "../../../utils/standartListMerge"
|
||||
|
||||
export default async (id: String) => {
|
||||
const response = await request({
|
||||
type Params = {
|
||||
limit?: Number
|
||||
offset?: Number
|
||||
sort?: String
|
||||
service?: String
|
||||
type?: String
|
||||
}
|
||||
|
||||
export default async (id: String, params?: Params) => {
|
||||
if (params && params.service) {
|
||||
const service = __comty_shared_state.addons.get(params.service)
|
||||
|
||||
if (!service) {
|
||||
throw new Error(
|
||||
`Service ${params.service} not found. Maybe is loading yet...`,
|
||||
)
|
||||
}
|
||||
|
||||
if (typeof service.getReleaseData !== "function") {
|
||||
throw new Error(
|
||||
`Service ${params.service} does not support "getReleaseData" operation`,
|
||||
)
|
||||
}
|
||||
|
||||
return await service.getReleaseData(id, params)
|
||||
}
|
||||
|
||||
const { data } = await request({
|
||||
method: "GET",
|
||||
url: `/music/releases/${id}/data`,
|
||||
params: params,
|
||||
})
|
||||
|
||||
// @ts-ignore
|
||||
return response.data
|
||||
return data
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user