From bddaed72da631e8d1a107531465552c04fc32a07 Mon Sep 17 00:00:00 2001 From: Norbaev Date: Wed, 3 Jul 2024 12:14:46 +0500 Subject: [PATCH 1/2] =?UTF-8?q?=D0=B8=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB?= =?UTF-8?q?=20=D0=B0=D0=B4=D1=80=D0=B5=D1=81=D0=B0=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20=D0=B2=20app.js?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/player.vue | 3 +-- client/src/services/app.js | 29 +++++++++++++++++++---------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/client/src/components/player.vue b/client/src/components/player.vue index 888b953..30474a8 100644 --- a/client/src/components/player.vue +++ b/client/src/components/player.vue @@ -271,8 +271,7 @@ export default { actionCurrentPlay(song) { // console.log('actionCurrentPlay', data); const currentPlay = { - ...this.currentPlay, - // Инфа про текущий трек + ...this.currentPlay, // Инфа про текущий трек ...song, // azura_id: song.id, isLoader: false, diff --git a/client/src/services/app.js b/client/src/services/app.js index 075289b..2781502 100644 --- a/client/src/services/app.js +++ b/client/src/services/app.js @@ -2,6 +2,7 @@ import { urlPath as settings } from '@/settings'; import { REST, RESTError } from './rest'; // запросы на сервер Django +// console.log(settings); export default class extends REST { static get settings() { @@ -56,7 +57,9 @@ export default class extends REST { } 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) => { return data; }) @@ -74,7 +77,9 @@ export default class extends REST { }); } 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) => { return data; }) @@ -82,8 +87,9 @@ export default class extends REST { throw new RESTError(error, 'Ошибка при получениии песни'); }); } - static createFavoriteForUser(params) { - return this._post(`radio/song/add_favorite`, {}, params) + static createFavoriteForUser(id) { + // return this._post(`radio/song/add_favorite`, {}, params) + return this._post(`radio/song/${id}/add_favorite`, {}, {}) .then((data) => { return data; }) @@ -159,8 +165,9 @@ export default class extends REST { }); } - static addSongToPlaylist(params) { - return this._post(`radio/playlists/add_to_playlist`, {}, params) + static addSongToPlaylist(id) { + // return this._post(`radio/playlists/add_to_playlist`, {}, params) + return this._post(`radio/playlists/${id}/add_to_playlist`, {}, {}) .then((data) => { return data; }) @@ -168,8 +175,9 @@ export default class extends REST { throw new RESTError(error, 'Ошибка при получении плейлистов'); }); } - static removeSongToPlaylist(params) { - return this._post(`radio/playlists/delete_song_with_playlist`, {}, params) + static removeSongToPlaylist(id) { + // return this._post(`radio/playlists/delete_song_with_playlist`, {}, params) + return this._post(`radio/playlists/${id}/delete_song_with_playlist`, {}, {}) .then((data) => { return data; }) @@ -177,8 +185,9 @@ export default class extends REST { throw new RESTError(error, 'Ошибка при удаления треков из плейлиста'); }); } - static updatePlaylist(params) { - return this._post(`radio/playlists/update_playlist`, {}, params) + static updatePlaylist(id) { + // return this._post(`radio/playlists/update_playlist`, {}, params) + return this._post(`radio/playlists/${id}/update_playlist`, {}, {}) .then((data) => { return data; }) From 838c14a4fff9a242c920e6d969768ddd822dab35 Mon Sep 17 00:00:00 2001 From: Norbaev Date: Wed, 3 Jul 2024 17:50:21 +0500 Subject: [PATCH 2/2] =?UTF-8?q?=D1=80=D0=BE=D1=83=D1=82=D1=8B=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B0=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D0=BE=D0=BB=D1=8C?= =?UTF-8?q?=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D0=B5=D0=B9=20=D0=B1?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D1=88=D0=B5=20=D0=BD=D0=B5=20=D0=B4=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=83=D0=BF=D1=8B=20=D0=B1=D0=B5=D0=B7=20=D0=B0?= =?UTF-8?q?=D0=B2=D1=82=D0=BE=D1=80=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/player.vue | 12 ++++++------ client/src/router/index.js | 26 ++++++++++++++++++++------ client/src/router/routes.js | 2 +- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/client/src/components/player.vue b/client/src/components/player.vue index 30474a8..e3b2d9d 100644 --- a/client/src/components/player.vue +++ b/client/src/components/player.vue @@ -35,7 +35,7 @@ - +
-
+
{ - if ( - to.matched.some((record) => record.meta.requiresAuth) && - !process.env.SERVER - ) { - if (store.state.user && store.state.user?.id) { + // console.log(to); + // console.log(process.env.SERVER); + // if ( + // to.matched.some((record) => record.meta.requiresAuth) && + // !process.env.SERVER + // ) { + // if (store.state.user && store.state.user?.id) { + // next(); + // } else { + // next({ name: 'home' }); + // this.$store.dispatch('setShowAuthModal', true); + // } + // } else { + // next(); + // } + + // console.log(to); + // console.log(from); + if (to.meta.isAuth) { + if (store.state.user) { next(); } else { next({ name: 'home' }); - this.$store.dispatch('setShowAuthModal', true); } } else { next(); diff --git a/client/src/router/routes.js b/client/src/router/routes.js index 6bc4bb8..9352d0a 100644 --- a/client/src/router/routes.js +++ b/client/src/router/routes.js @@ -79,7 +79,7 @@ const routes = [ component: profile, meta: { title: 'Личный кабинет', - isAuth: false, + isAuth: true, }, children: [ {