mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
remove unused method
This commit is contained in:
parent
df462d842f
commit
5a79ecabbf
@ -1,61 +1,12 @@
|
||||
export default class PlaylistsModel {
|
||||
static async uploadTrack(file, payload) {
|
||||
// get the file from the payload
|
||||
if (!file) {
|
||||
throw new Error("File is required")
|
||||
static async putPlaylist(payload) {
|
||||
if (!payload) {
|
||||
throw new Error("Payload is required")
|
||||
}
|
||||
|
||||
console.log(file)
|
||||
|
||||
// create a new form data
|
||||
const formData = new FormData()
|
||||
|
||||
// append the file to the form data
|
||||
formData.append("files", file)
|
||||
|
||||
// send the request
|
||||
const uploadRequest = await app.cores.api.customRequest({
|
||||
method: "POST",
|
||||
url: "/upload",
|
||||
data: formData,
|
||||
})
|
||||
|
||||
console.log(uploadRequest.data)
|
||||
|
||||
if (!uploadRequest.data.files[0]) {
|
||||
throw new Error("Upload failed")
|
||||
}
|
||||
|
||||
// get the url
|
||||
const source = uploadRequest.data.files[0].url
|
||||
|
||||
// send the request for the track to be created
|
||||
const trackRequest = await app.cores.api.customRequest({
|
||||
method: "POST",
|
||||
url: "/tracks/publish",
|
||||
data: {
|
||||
...payload,
|
||||
source,
|
||||
}
|
||||
})
|
||||
|
||||
return trackRequest.data
|
||||
}
|
||||
|
||||
static async publishTrack(payload) {
|
||||
const { data } = await app.cores.api.customRequest({
|
||||
method: "POST",
|
||||
url: "/tracks/publish",
|
||||
data: payload,
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
static async publish(payload) {
|
||||
const { data } = await app.cores.api.customRequest({
|
||||
method: "POST",
|
||||
url: `/playlist/publish`,
|
||||
method: "PUT",
|
||||
url: `/playlist`,
|
||||
data: payload,
|
||||
})
|
||||
|
||||
@ -80,38 +31,6 @@ export default class PlaylistsModel {
|
||||
return data
|
||||
}
|
||||
|
||||
static async updateTrack(payload) {
|
||||
if (!payload) {
|
||||
throw new Error("Payload is required")
|
||||
}
|
||||
|
||||
const { data } = await app.cores.api.customRequest({
|
||||
method: "PUT",
|
||||
url: `/tracks/${payload._id}`,
|
||||
data: {
|
||||
payload
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
static async updatePlaylist(payload) {
|
||||
if (!payload) {
|
||||
throw new Error("Payload is required")
|
||||
}
|
||||
|
||||
const { data } = await app.cores.api.customRequest({
|
||||
method: "PUT",
|
||||
url: `/playlist/${payload._id}`,
|
||||
data: {
|
||||
payload
|
||||
},
|
||||
})
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
static async deletePlaylist(id) {
|
||||
if (!id) {
|
||||
throw new Error("ID is required")
|
||||
|
Loading…
x
Reference in New Issue
Block a user