изменил адреса запросов в app.js

This commit is contained in:
Norbaev 2024-07-03 12:14:46 +05:00
parent f7776c1f19
commit bddaed72da
2 changed files with 20 additions and 12 deletions

View File

@ -271,8 +271,7 @@ export default {
actionCurrentPlay(song) { actionCurrentPlay(song) {
// console.log('actionCurrentPlay', data); // console.log('actionCurrentPlay', data);
const currentPlay = { const currentPlay = {
...this.currentPlay, ...this.currentPlay, // Инфа про текущий трек
// Инфа про текущий трек
...song, ...song,
// azura_id: song.id, // azura_id: song.id,
isLoader: false, isLoader: false,

View File

@ -2,6 +2,7 @@ import { urlPath as settings } from '@/settings';
import { REST, RESTError } from './rest'; import { REST, RESTError } from './rest';
// запросы на сервер Django // запросы на сервер Django
// console.log(settings);
export default class extends REST { export default class extends REST {
static get settings() { static get settings() {
@ -56,7 +57,9 @@ export default class extends REST {
} }
static getCheckFavoriteSong(id) { static getCheckFavoriteSong(id) {
return this._get(`radio/song/check_is_favorite/${id}`, {}, {}) // return this._get(`radio/song/check_is_favorite/${id}`, {}, {})
return this._get(`radio/song/${id}/check_is_favorite`, {}, {})
.then((data) => { .then((data) => {
return data; return data;
}) })
@ -74,7 +77,9 @@ export default class extends REST {
}); });
} }
static getAudio(id) { static getAudio(id) {
return this._get(`radio/song/get_audio/${id}`, {}, {}, false, true) // return this._get(`radio/song/get_audio/${id}`, {}, {}, false, true)
return this._get(`radio/song/${id}/get_audio/`, {}, {}, false, true)
.then((data) => { .then((data) => {
return data; return data;
}) })
@ -82,8 +87,9 @@ export default class extends REST {
throw new RESTError(error, 'Ошибка при получениии песни'); throw new RESTError(error, 'Ошибка при получениии песни');
}); });
} }
static createFavoriteForUser(params) { static createFavoriteForUser(id) {
return this._post(`radio/song/add_favorite`, {}, params) // return this._post(`radio/song/add_favorite`, {}, params)
return this._post(`radio/song/${id}/add_favorite`, {}, {})
.then((data) => { .then((data) => {
return data; return data;
}) })
@ -159,8 +165,9 @@ export default class extends REST {
}); });
} }
static addSongToPlaylist(params) { static addSongToPlaylist(id) {
return this._post(`radio/playlists/add_to_playlist`, {}, params) // return this._post(`radio/playlists/add_to_playlist`, {}, params)
return this._post(`radio/playlists/${id}/add_to_playlist`, {}, {})
.then((data) => { .then((data) => {
return data; return data;
}) })
@ -168,8 +175,9 @@ export default class extends REST {
throw new RESTError(error, 'Ошибка при получении плейлистов'); throw new RESTError(error, 'Ошибка при получении плейлистов');
}); });
} }
static removeSongToPlaylist(params) { static removeSongToPlaylist(id) {
return this._post(`radio/playlists/delete_song_with_playlist`, {}, params) // return this._post(`radio/playlists/delete_song_with_playlist`, {}, params)
return this._post(`radio/playlists/${id}/delete_song_with_playlist`, {}, {})
.then((data) => { .then((data) => {
return data; return data;
}) })
@ -177,8 +185,9 @@ export default class extends REST {
throw new RESTError(error, 'Ошибка при удаления треков из плейлиста'); throw new RESTError(error, 'Ошибка при удаления треков из плейлиста');
}); });
} }
static updatePlaylist(params) { static updatePlaylist(id) {
return this._post(`radio/playlists/update_playlist`, {}, params) // return this._post(`radio/playlists/update_playlist`, {}, params)
return this._post(`radio/playlists/${id}/update_playlist`, {}, {})
.then((data) => { .then((data) => {
return data; return data;
}) })