Replaced vue-resource by axios
This commit is contained in:
parent
c7070042fb
commit
e4edf55c47
|
@ -43,7 +43,7 @@ class TrackFavoriteViewSet(mixins.CreateModelMixin,
|
||||||
favorite = models.TrackFavorite.add(track=track, user=self.request.user)
|
favorite = models.TrackFavorite.add(track=track, user=self.request.user)
|
||||||
return favorite
|
return favorite
|
||||||
|
|
||||||
@list_route(methods=['delete'])
|
@list_route(methods=['delete', 'post'])
|
||||||
def remove(self, request, *args, **kwargs):
|
def remove(self, request, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
pk = int(request.data['track'])
|
pk = int(request.data['track'])
|
||||||
|
|
|
@ -4,7 +4,7 @@ Populates the database with fake data
|
||||||
import random
|
import random
|
||||||
|
|
||||||
from funkwhale_api.music import models
|
from funkwhale_api.music import models
|
||||||
from funkwhale_api.music.tests import factories
|
from funkwhale_api.music import factories
|
||||||
|
|
||||||
|
|
||||||
def create_data(count=25):
|
def create_data(count=25):
|
||||||
|
@ -19,4 +19,4 @@ def create_data(count=25):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
create_data()
|
||||||
|
|
|
@ -58,11 +58,14 @@ def test_user_can_remove_favorite_via_api(logged_in_client, factories, client):
|
||||||
assert response.status_code == 204
|
assert response.status_code == 204
|
||||||
assert TrackFavorite.objects.count() == 0
|
assert TrackFavorite.objects.count() == 0
|
||||||
|
|
||||||
def test_user_can_remove_favorite_via_api_using_track_id(factories, logged_in_client):
|
|
||||||
|
@pytest.mark.parametrize('method', ['delete', 'post'])
|
||||||
|
def test_user_can_remove_favorite_via_api_using_track_id(
|
||||||
|
method, factories, logged_in_client):
|
||||||
favorite = factories['favorites.TrackFavorite'](user=logged_in_client.user)
|
favorite = factories['favorites.TrackFavorite'](user=logged_in_client.user)
|
||||||
|
|
||||||
url = reverse('api:v1:favorites:tracks-remove')
|
url = reverse('api:v1:favorites:tracks-remove')
|
||||||
response = logged_in_client.delete(
|
response = getattr(logged_in_client, method)(
|
||||||
url, json.dumps({'track': favorite.track.pk}),
|
url, json.dumps({'track': favorite.track.pk}),
|
||||||
content_type='application/json'
|
content_type='application/json'
|
||||||
)
|
)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
|
"lint": "eslint --ext .js,.vue src test/unit/specs test/e2e/specs"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"axios": "^0.17.1",
|
||||||
"dateformat": "^2.0.0",
|
"dateformat": "^2.0.0",
|
||||||
"js-logger": "^1.3.0",
|
"js-logger": "^1.3.0",
|
||||||
"jwt-decode": "^2.2.0",
|
"jwt-decode": "^2.2.0",
|
||||||
|
@ -22,7 +23,6 @@
|
||||||
"semantic-ui-css": "^2.2.10",
|
"semantic-ui-css": "^2.2.10",
|
||||||
"vue": "^2.3.3",
|
"vue": "^2.3.3",
|
||||||
"vue-lazyload": "^1.1.4",
|
"vue-lazyload": "^1.1.4",
|
||||||
"vue-resource": "^1.3.4",
|
|
||||||
"vue-router": "^2.3.1",
|
"vue-router": "^2.3.1",
|
||||||
"vue-upload-component": "^2.7.4",
|
"vue-upload-component": "^2.7.4",
|
||||||
"vuedraggable": "^2.14.1",
|
"vuedraggable": "^2.14.1",
|
||||||
|
@ -69,6 +69,7 @@
|
||||||
"karma-phantomjs-launcher": "^1.0.2",
|
"karma-phantomjs-launcher": "^1.0.2",
|
||||||
"karma-phantomjs-shim": "^1.4.0",
|
"karma-phantomjs-shim": "^1.4.0",
|
||||||
"karma-sinon-chai": "^1.3.1",
|
"karma-sinon-chai": "^1.3.1",
|
||||||
|
"karma-sinon-stub-promise": "^1.0.0",
|
||||||
"karma-sourcemap-loader": "^0.3.7",
|
"karma-sourcemap-loader": "^0.3.7",
|
||||||
"karma-spec-reporter": "0.0.30",
|
"karma-spec-reporter": "0.0.30",
|
||||||
"karma-webpack": "^2.0.2",
|
"karma-webpack": "^2.0.2",
|
||||||
|
@ -87,6 +88,7 @@
|
||||||
"shelljs": "^0.7.6",
|
"shelljs": "^0.7.6",
|
||||||
"sinon": "^2.1.0",
|
"sinon": "^2.1.0",
|
||||||
"sinon-chai": "^2.8.0",
|
"sinon-chai": "^2.8.0",
|
||||||
|
"sinon-stub-promise": "^4.0.0",
|
||||||
"url-loader": "^0.5.8",
|
"url-loader": "^0.5.8",
|
||||||
"vue-loader": "^12.1.0",
|
"vue-loader": "^12.1.0",
|
||||||
"vue-style-loader": "^3.0.1",
|
"vue-style-loader": "^3.0.1",
|
||||||
|
|
|
@ -29,13 +29,11 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import backend from '@/audio/backend'
|
import backend from '@/audio/backend'
|
||||||
import AlbumCard from '@/components/audio/album/Card'
|
import AlbumCard from '@/components/audio/album/Card'
|
||||||
import ArtistCard from '@/components/audio/artist/Card'
|
import ArtistCard from '@/components/audio/artist/Card'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
const SEARCH_URL = config.API_URL + 'search'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -73,17 +71,8 @@ export default {
|
||||||
let params = {
|
let params = {
|
||||||
query: this.query
|
query: this.query
|
||||||
}
|
}
|
||||||
this.$http.get(SEARCH_URL, {
|
axios.get('search', {
|
||||||
params: params,
|
params: params
|
||||||
before (request) {
|
|
||||||
// abort previous request, if exists
|
|
||||||
if (this.previousRequest) {
|
|
||||||
this.previousRequest.abort()
|
|
||||||
}
|
|
||||||
|
|
||||||
// set previous request on Vue instance
|
|
||||||
this.previousRequest = request
|
|
||||||
}
|
|
||||||
}).then((response) => {
|
}).then((response) => {
|
||||||
self.results = self.castResults(response.data)
|
self.results = self.castResults(response.data)
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import axios from 'axios'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ export default {
|
||||||
new_password1: this.new_password,
|
new_password1: this.new_password,
|
||||||
new_password2: this.new_password
|
new_password2: this.new_password
|
||||||
}
|
}
|
||||||
let resource = Vue.resource(config.BACKEND_URL + 'api/auth/registration/change-password/')
|
let url = config.BACKEND_URL + 'api/auth/registration/change-password/'
|
||||||
return resource.save({}, credentials).then(response => {
|
return axios.post(url, credentials).then(response => {
|
||||||
logger.default.info('Password successfully changed')
|
logger.default.info('Password successfully changed')
|
||||||
self.$router.push('/profile/me')
|
self.$router.push('/profile/me')
|
||||||
}, response => {
|
}, response => {
|
||||||
|
|
|
@ -54,15 +54,15 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import config from '@/config'
|
|
||||||
import TrackTable from '@/components/audio/track/Table'
|
import TrackTable from '@/components/audio/track/Table'
|
||||||
import RadioButton from '@/components/radios/Button'
|
import RadioButton from '@/components/radios/Button'
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
import OrderingMixin from '@/components/mixins/Ordering'
|
import OrderingMixin from '@/components/mixins/Ordering'
|
||||||
import PaginationMixin from '@/components/mixins/Pagination'
|
import PaginationMixin from '@/components/mixins/Pagination'
|
||||||
const FAVORITES_URL = config.API_URL + 'tracks/'
|
const FAVORITES_URL = 'tracks/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [OrderingMixin, PaginationMixin],
|
mixins: [OrderingMixin, PaginationMixin],
|
||||||
|
@ -115,7 +115,7 @@ export default {
|
||||||
ordering: this.getOrderingAsString()
|
ordering: this.getOrderingAsString()
|
||||||
}
|
}
|
||||||
logger.default.time('Loading user favorites')
|
logger.default.time('Loading user favorites')
|
||||||
this.$http.get(url, {params: params}).then((response) => {
|
axios.get(url, {params: params}).then((response) => {
|
||||||
self.results = response.data
|
self.results = response.data
|
||||||
self.nextLink = response.data.next
|
self.nextLink = response.data.next
|
||||||
self.previousLink = response.data.previous
|
self.previousLink = response.data.previous
|
||||||
|
|
|
@ -41,14 +41,13 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import backend from '@/audio/backend'
|
import backend from '@/audio/backend'
|
||||||
import PlayButton from '@/components/audio/PlayButton'
|
import PlayButton from '@/components/audio/PlayButton'
|
||||||
import TrackTable from '@/components/audio/track/Table'
|
import TrackTable from '@/components/audio/track/Table'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
const FETCH_URL = config.API_URL + 'albums/'
|
const FETCH_URL = 'albums/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id'],
|
props: ['id'],
|
||||||
|
@ -71,7 +70,7 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let url = FETCH_URL + this.id + '/'
|
let url = FETCH_URL + this.id + '/'
|
||||||
logger.default.debug('Fetching album "' + this.id + '"')
|
logger.default.debug('Fetching album "' + this.id + '"')
|
||||||
this.$http.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.album = backend.Album.clean(response.data)
|
self.album = backend.Album.clean(response.data)
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
})
|
})
|
||||||
|
|
|
@ -41,15 +41,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import backend from '@/audio/backend'
|
import backend from '@/audio/backend'
|
||||||
import AlbumCard from '@/components/audio/album/Card'
|
import AlbumCard from '@/components/audio/album/Card'
|
||||||
import RadioButton from '@/components/radios/Button'
|
import RadioButton from '@/components/radios/Button'
|
||||||
import PlayButton from '@/components/audio/PlayButton'
|
import PlayButton from '@/components/audio/PlayButton'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
const FETCH_URL = config.API_URL + 'artists/'
|
const FETCH_URL = 'artists/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id'],
|
props: ['id'],
|
||||||
|
@ -74,7 +73,7 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let url = FETCH_URL + this.id + '/'
|
let url = FETCH_URL + this.id + '/'
|
||||||
logger.default.debug('Fetching artist "' + this.id + '"')
|
logger.default.debug('Fetching artist "' + this.id + '"')
|
||||||
this.$http.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.artist = response.data
|
self.artist = response.data
|
||||||
self.albums = JSON.parse(JSON.stringify(self.artist.albums)).map((album) => {
|
self.albums = JSON.parse(JSON.stringify(self.artist.albums)).map((album) => {
|
||||||
return backend.Album.clean(album)
|
return backend.Album.clean(album)
|
||||||
|
|
|
@ -57,10 +57,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
|
|
||||||
import config from '@/config'
|
|
||||||
import backend from '@/audio/backend'
|
import backend from '@/audio/backend'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ import PaginationMixin from '@/components/mixins/Pagination'
|
||||||
import ArtistCard from '@/components/audio/artist/Card'
|
import ArtistCard from '@/components/audio/artist/Card'
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
||||||
const FETCH_URL = config.API_URL + 'artists/'
|
const FETCH_URL = 'artists/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [OrderingMixin, PaginationMixin],
|
mixins: [OrderingMixin, PaginationMixin],
|
||||||
|
@ -124,7 +124,7 @@ export default {
|
||||||
ordering: this.getOrderingAsString()
|
ordering: this.getOrderingAsString()
|
||||||
}
|
}
|
||||||
logger.default.debug('Fetching artists')
|
logger.default.debug('Fetching artists')
|
||||||
this.$http.get(url, {params: params}).then((response) => {
|
axios.get(url, {params: params}).then((response) => {
|
||||||
self.result = response.data
|
self.result = response.data
|
||||||
self.result.results.map((artist) => {
|
self.result.results.map((artist) => {
|
||||||
var albums = JSON.parse(JSON.stringify(artist.albums)).map((album) => {
|
var albums = JSON.parse(JSON.stringify(artist.albums)).map((album) => {
|
||||||
|
|
|
@ -24,14 +24,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import Search from '@/components/audio/Search'
|
import Search from '@/components/audio/Search'
|
||||||
import backend from '@/audio/backend'
|
import backend from '@/audio/backend'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import ArtistCard from '@/components/audio/artist/Card'
|
import ArtistCard from '@/components/audio/artist/Card'
|
||||||
import config from '@/config'
|
|
||||||
import RadioCard from '@/components/radios/Card'
|
import RadioCard from '@/components/radios/Card'
|
||||||
|
|
||||||
const ARTISTS_URL = config.API_URL + 'artists/'
|
const ARTISTS_URL = 'artists/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'library',
|
name: 'library',
|
||||||
|
@ -58,7 +58,7 @@ export default {
|
||||||
}
|
}
|
||||||
let url = ARTISTS_URL
|
let url = ARTISTS_URL
|
||||||
logger.default.time('Loading latest artists')
|
logger.default.time('Loading latest artists')
|
||||||
this.$http.get(url, {params: params}).then((response) => {
|
axios.get(url, {params: params}).then((response) => {
|
||||||
self.artists = response.data.results
|
self.artists = response.data.results
|
||||||
self.artists.map((artist) => {
|
self.artists.map((artist) => {
|
||||||
var albums = JSON.parse(JSON.stringify(artist.albums)).map((album) => {
|
var albums = JSON.parse(JSON.stringify(artist.albums)).map((album) => {
|
||||||
|
|
|
@ -59,10 +59,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
|
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
import OrderingMixin from '@/components/mixins/Ordering'
|
import OrderingMixin from '@/components/mixins/Ordering'
|
||||||
|
@ -70,7 +70,7 @@ import PaginationMixin from '@/components/mixins/Pagination'
|
||||||
import RadioCard from '@/components/radios/Card'
|
import RadioCard from '@/components/radios/Card'
|
||||||
import Pagination from '@/components/Pagination'
|
import Pagination from '@/components/Pagination'
|
||||||
|
|
||||||
const FETCH_URL = config.API_URL + 'radios/radios/'
|
const FETCH_URL = 'radios/radios/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
mixins: [OrderingMixin, PaginationMixin],
|
mixins: [OrderingMixin, PaginationMixin],
|
||||||
|
@ -125,7 +125,7 @@ export default {
|
||||||
ordering: this.getOrderingAsString()
|
ordering: this.getOrderingAsString()
|
||||||
}
|
}
|
||||||
logger.default.debug('Fetching radios')
|
logger.default.debug('Fetching radios')
|
||||||
this.$http.get(url, {params: params}).then((response) => {
|
axios.get(url, {params: params}).then((response) => {
|
||||||
self.result = response.data
|
self.result = response.data
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
})
|
})
|
||||||
|
|
|
@ -60,15 +60,14 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import url from '@/utils/url'
|
import url from '@/utils/url'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import backend from '@/audio/backend'
|
import backend from '@/audio/backend'
|
||||||
import PlayButton from '@/components/audio/PlayButton'
|
import PlayButton from '@/components/audio/PlayButton'
|
||||||
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
|
import TrackFavoriteIcon from '@/components/favorites/TrackFavoriteIcon'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
const FETCH_URL = config.API_URL + 'tracks/'
|
const FETCH_URL = 'tracks/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id'],
|
props: ['id'],
|
||||||
|
@ -94,7 +93,7 @@ export default {
|
||||||
this.isLoadingTrack = true
|
this.isLoadingTrack = true
|
||||||
let url = FETCH_URL + this.id + '/'
|
let url = FETCH_URL + this.id + '/'
|
||||||
logger.default.debug('Fetching track "' + this.id + '"')
|
logger.default.debug('Fetching track "' + this.id + '"')
|
||||||
this.$http.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.track = response.data
|
self.track = response.data
|
||||||
self.isLoadingTrack = false
|
self.isLoadingTrack = false
|
||||||
})
|
})
|
||||||
|
@ -104,7 +103,7 @@ export default {
|
||||||
this.isLoadingLyrics = true
|
this.isLoadingLyrics = true
|
||||||
let url = FETCH_URL + this.id + '/lyrics/'
|
let url = FETCH_URL + this.id + '/lyrics/'
|
||||||
logger.default.debug('Fetching lyrics for track "' + this.id + '"')
|
logger.default.debug('Fetching lyrics for track "' + this.id + '"')
|
||||||
this.$http.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.lyrics = response.data
|
self.lyrics = response.data
|
||||||
self.isLoadingLyrics = false
|
self.isLoadingLyrics = false
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
|
|
|
@ -37,8 +37,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
import ImportMixin from './ImportMixin'
|
import ImportMixin from './ImportMixin'
|
||||||
import ReleaseImport from './ReleaseImport'
|
import ReleaseImport from './ReleaseImport'
|
||||||
|
@ -92,9 +92,8 @@ export default Vue.extend({
|
||||||
fetchReleaseGroupsData () {
|
fetchReleaseGroupsData () {
|
||||||
let self = this
|
let self = this
|
||||||
this.releaseGroups.forEach(group => {
|
this.releaseGroups.forEach(group => {
|
||||||
let url = config.API_URL + 'providers/musicbrainz/releases/browse/' + group.id + '/'
|
let url = 'providers/musicbrainz/releases/browse/' + group.id + '/'
|
||||||
let resource = Vue.resource(url)
|
return axios.get(url).then((response) => {
|
||||||
resource.get({}).then((response) => {
|
|
||||||
logger.default.info('successfully fetched release group', group.id)
|
logger.default.info('successfully fetched release group', group.id)
|
||||||
let release = response.data['release-list'].filter(r => {
|
let release = response.data['release-list'].filter(r => {
|
||||||
return r.status === 'Official'
|
return r.status === 'Official'
|
||||||
|
|
|
@ -52,11 +52,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
const FETCH_URL = config.API_URL + 'import-batches/'
|
const FETCH_URL = 'import-batches/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['id'],
|
props: ['id'],
|
||||||
|
@ -75,7 +74,7 @@ export default {
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let url = FETCH_URL + this.id + '/'
|
let url = FETCH_URL + this.id + '/'
|
||||||
logger.default.debug('Fetching batch "' + this.id + '"')
|
logger.default.debug('Fetching batch "' + this.id + '"')
|
||||||
this.$http.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.batch = response.data
|
self.batch = response.data
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
if (self.batch.status === 'pending') {
|
if (self.batch.status === 'pending') {
|
||||||
|
|
|
@ -42,10 +42,10 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
const BATCHES_URL = config.API_URL + 'import-batches/'
|
const BATCHES_URL = 'import-batches/'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {},
|
components: {},
|
||||||
|
@ -65,7 +65,7 @@ export default {
|
||||||
var self = this
|
var self = this
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
logger.default.time('Loading import batches')
|
logger.default.time('Loading import batches')
|
||||||
this.$http.get(url, {}).then((response) => {
|
axios.get(url, {}).then((response) => {
|
||||||
self.results = response.data.results
|
self.results = response.data.results
|
||||||
self.nextLink = response.data.next
|
self.nextLink = response.data.next
|
||||||
self.previousLink = response.data.previous
|
self.previousLink = response.data.previous
|
||||||
|
|
|
@ -62,10 +62,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Vue from 'vue'
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import FileUploadWidget from './FileUploadWidget'
|
import FileUploadWidget from './FileUploadWidget'
|
||||||
import config from '@/config'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
@ -74,7 +73,7 @@ export default {
|
||||||
data () {
|
data () {
|
||||||
return {
|
return {
|
||||||
files: [],
|
files: [],
|
||||||
uploadUrl: config.API_URL + 'import-jobs/',
|
uploadUrl: 'import-jobs/',
|
||||||
batch: null
|
batch: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -106,9 +105,7 @@ export default {
|
||||||
},
|
},
|
||||||
createBatch () {
|
createBatch () {
|
||||||
let self = this
|
let self = this
|
||||||
let url = config.API_URL + 'import-batches/'
|
return axios.post('import-batches/', {}).then((response) => {
|
||||||
let resource = Vue.resource(url)
|
|
||||||
resource.save({}, {}).then((response) => {
|
|
||||||
self.batch = response.data
|
self.batch = response.data
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
logger.default.error('error while launching creating batch')
|
logger.default.error('error while launching creating batch')
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import config from '@/config'
|
|
||||||
import Vue from 'vue'
|
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -31,10 +30,9 @@ export default {
|
||||||
launchImport () {
|
launchImport () {
|
||||||
let self = this
|
let self = this
|
||||||
this.isImporting = true
|
this.isImporting = true
|
||||||
let url = config.API_URL + 'submit/' + self.importType + '/'
|
let url = 'submit/' + self.importType + '/'
|
||||||
let payload = self.importData
|
let payload = self.importData
|
||||||
let resource = Vue.resource(url)
|
axios.post(url, payload).then((response) => {
|
||||||
resource.save({}, payload).then((response) => {
|
|
||||||
logger.default.info('launched import for', self.type, self.metadata.id)
|
logger.default.info('launched import for', self.type, self.metadata.id)
|
||||||
self.isImporting = false
|
self.isImporting = false
|
||||||
router.push({
|
router.push({
|
||||||
|
|
|
@ -70,9 +70,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import time from '@/utils/time'
|
import time from '@/utils/time'
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import ImportMixin from './ImportMixin'
|
import ImportMixin from './ImportMixin'
|
||||||
|
|
||||||
|
@ -117,10 +117,8 @@ export default Vue.extend({
|
||||||
search () {
|
search () {
|
||||||
let self = this
|
let self = this
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let url = config.API_URL + 'providers/' + this.currentBackendId + '/search/'
|
let url = 'providers/' + this.currentBackendId + '/search/'
|
||||||
let resource = Vue.resource(url)
|
axios.get(url, {params: {query: this.query}}).then((response) => {
|
||||||
|
|
||||||
resource.get({query: this.query}).then((response) => {
|
|
||||||
logger.default.debug('searching', self.query, 'on', self.currentBackendId)
|
logger.default.debug('searching', self.query, 'on', self.currentBackendId)
|
||||||
self.results = response.data
|
self.results = response.data
|
||||||
self.isLoading = false
|
self.isLoading = false
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import config from '@/config'
|
import axios from 'axios'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import BuilderFilter from './Filter'
|
import BuilderFilter from './Filter'
|
||||||
|
@ -107,8 +107,8 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
fetchFilters: function () {
|
fetchFilters: function () {
|
||||||
let self = this
|
let self = this
|
||||||
let url = config.API_URL + 'radios/radios/filters/'
|
let url = 'radios/radios/filters/'
|
||||||
return this.$http.get(url).then((response) => {
|
return axios.get(url).then((response) => {
|
||||||
self.availableFilters = response.data
|
self.availableFilters = response.data
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -130,8 +130,8 @@ export default {
|
||||||
},
|
},
|
||||||
fetch: function () {
|
fetch: function () {
|
||||||
let self = this
|
let self = this
|
||||||
let url = config.API_URL + 'radios/radios/' + this.id + '/'
|
let url = 'radios/radios/' + this.id + '/'
|
||||||
this.$http.get(url).then((response) => {
|
axios.get(url).then((response) => {
|
||||||
self.filters = response.data.config.map(f => {
|
self.filters = response.data.config.map(f => {
|
||||||
return {
|
return {
|
||||||
config: f,
|
config: f,
|
||||||
|
@ -145,7 +145,7 @@ export default {
|
||||||
},
|
},
|
||||||
fetchCandidates: function () {
|
fetchCandidates: function () {
|
||||||
let self = this
|
let self = this
|
||||||
let url = config.API_URL + 'radios/radios/validate/'
|
let url = 'radios/radios/validate/'
|
||||||
let final = this.filters.map(f => {
|
let final = this.filters.map(f => {
|
||||||
let c = _.clone(f.config)
|
let c = _.clone(f.config)
|
||||||
c.type = f.filter.type
|
c.type = f.filter.type
|
||||||
|
@ -156,7 +156,7 @@ export default {
|
||||||
{'type': 'group', filters: final}
|
{'type': 'group', filters: final}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
this.$http.post(url, final).then((response) => {
|
axios.post(url, final).then((response) => {
|
||||||
self.checkResult = response.data.filters[0]
|
self.checkResult = response.data.filters[0]
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
@ -173,12 +173,12 @@ export default {
|
||||||
'config': final
|
'config': final
|
||||||
}
|
}
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
let url = config.API_URL + 'radios/radios/' + this.id + '/'
|
let url = 'radios/radios/' + this.id + '/'
|
||||||
this.$http.put(url, final).then((response) => {
|
axios.put(url, final).then((response) => {
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let url = config.API_URL + 'radios/radios/'
|
let url = 'radios/radios/'
|
||||||
this.$http.post(url, final).then((response) => {
|
axios.post(url, final).then((response) => {
|
||||||
self.$router.push({
|
self.$router.push({
|
||||||
name: 'library.radios.edit',
|
name: 'library.radios.edit',
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -62,6 +62,7 @@
|
||||||
</tr>
|
</tr>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import config from '@/config'
|
import config from '@/config'
|
||||||
import $ from 'jquery'
|
import $ from 'jquery'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
|
@ -132,11 +133,11 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
fetchCandidates: function () {
|
fetchCandidates: function () {
|
||||||
let self = this
|
let self = this
|
||||||
let url = config.API_URL + 'radios/radios/validate/'
|
let url = 'radios/radios/validate/'
|
||||||
let final = _.clone(this.config)
|
let final = _.clone(this.config)
|
||||||
final.type = this.filter.type
|
final.type = this.filter.type
|
||||||
final = {'filters': [final]}
|
final = {'filters': [final]}
|
||||||
this.$http.post(url, final).then((response) => {
|
axios.post(url, final).then((response) => {
|
||||||
self.checkResult = response.data.filters[0]
|
self.checkResult = response.data.filters[0]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,9 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import axios from 'axios'
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
import config from '@/config'
|
|
||||||
import Vue from 'vue'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
mbId: {type: String, required: true}
|
mbId: {type: String, required: true}
|
||||||
|
@ -25,9 +23,8 @@ export default {
|
||||||
fetchData () {
|
fetchData () {
|
||||||
let self = this
|
let self = this
|
||||||
this.isLoading = true
|
this.isLoading = true
|
||||||
let url = config.API_URL + 'providers/musicbrainz/' + this.type + 's/' + this.mbId + '/'
|
let url = 'providers/musicbrainz/' + this.type + 's/' + this.mbId + '/'
|
||||||
let resource = Vue.resource(url)
|
axios.get(url).then((response) => {
|
||||||
resource.get({}).then((response) => {
|
|
||||||
logger.default.info('successfully fetched', self.type, self.mbId)
|
logger.default.info('successfully fetched', self.type, self.mbId)
|
||||||
self.data = response.data[self.type]
|
self.data = response.data[self.type]
|
||||||
this.$emit('metadata-changed', self.data)
|
this.$emit('metadata-changed', self.data)
|
||||||
|
|
|
@ -4,7 +4,7 @@ class Config {
|
||||||
if (this.BACKEND_URL === '/') {
|
if (this.BACKEND_URL === '/') {
|
||||||
this.BACKEND_URL = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
|
this.BACKEND_URL = window.location.protocol + '//' + window.location.hostname + ':' + window.location.port
|
||||||
}
|
}
|
||||||
if (!this.BACKEND_URL.slice(-1) === '/') {
|
if (this.BACKEND_URL.slice(-1) !== '/') {
|
||||||
this.BACKEND_URL += '/'
|
this.BACKEND_URL += '/'
|
||||||
}
|
}
|
||||||
this.API_URL = this.BACKEND_URL + 'api/v1/'
|
this.API_URL = this.BACKEND_URL + 'api/v1/'
|
||||||
|
|
|
@ -8,9 +8,10 @@ logger.default.debug('Environment variables:', process.env)
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import App from './App'
|
import App from './App'
|
||||||
import router from './router'
|
import router from './router'
|
||||||
import VueResource from 'vue-resource'
|
import axios from 'axios'
|
||||||
import VueLazyload from 'vue-lazyload'
|
import VueLazyload from 'vue-lazyload'
|
||||||
import store from './store'
|
import store from './store'
|
||||||
|
import config from './config'
|
||||||
|
|
||||||
window.$ = window.jQuery = require('jquery')
|
window.$ = window.jQuery = require('jquery')
|
||||||
|
|
||||||
|
@ -19,25 +20,33 @@ window.$ = window.jQuery = require('jquery')
|
||||||
// require('./semantic/semantic.css')
|
// require('./semantic/semantic.css')
|
||||||
require('semantic-ui-css/semantic.js')
|
require('semantic-ui-css/semantic.js')
|
||||||
|
|
||||||
Vue.use(VueResource)
|
|
||||||
Vue.use(VueLazyload)
|
Vue.use(VueLazyload)
|
||||||
Vue.config.productionTip = false
|
Vue.config.productionTip = false
|
||||||
|
|
||||||
Vue.http.interceptors.push(function (request, next) {
|
axios.defaults.baseURL = config.API_URL
|
||||||
// modify headers
|
axios.interceptors.request.use(function (config) {
|
||||||
|
// Do something before request is sent
|
||||||
if (store.state.auth.authenticated) {
|
if (store.state.auth.authenticated) {
|
||||||
request.headers.set('Authorization', store.getters['auth/header'])
|
config.headers['Authorization'] = store.getters['auth/header']
|
||||||
}
|
}
|
||||||
next(function (response) {
|
return config
|
||||||
// redirect to login form when we get unauthorized response from server
|
}, function (error) {
|
||||||
if (response.status === 401) {
|
// Do something with request error
|
||||||
store.commit('auth/authenticated', false)
|
return Promise.reject(error)
|
||||||
logger.default.warn('Received 401 response from API, redirecting to login form')
|
|
||||||
router.push({name: 'login', query: {next: router.currentRoute.fullPath}})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Add a response interceptor
|
||||||
|
axios.interceptors.response.use(function (response) {
|
||||||
|
if (response.status === 401) {
|
||||||
|
store.commit('auth/authenticated', false)
|
||||||
|
logger.default.warn('Received 401 response from API, redirecting to login form')
|
||||||
|
router.push({name: 'login', query: {next: router.currentRoute.fullPath}})
|
||||||
|
}
|
||||||
|
return response
|
||||||
|
}, function (error) {
|
||||||
|
// Do something with response error
|
||||||
|
return Promise.reject(error)
|
||||||
|
})
|
||||||
store.dispatch('auth/check')
|
store.dispatch('auth/check')
|
||||||
/* eslint-disable no-new */
|
/* eslint-disable no-new */
|
||||||
new Vue({
|
new Vue({
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
import Vue from 'vue'
|
import axios from 'axios'
|
||||||
import jwtDecode from 'jwt-decode'
|
import jwtDecode from 'jwt-decode'
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import router from '@/router'
|
import router from '@/router'
|
||||||
|
|
||||||
const LOGIN_URL = config.API_URL + 'token/'
|
|
||||||
const REFRESH_TOKEN_URL = config.API_URL + 'token/refresh/'
|
|
||||||
const USER_PROFILE_URL = config.API_URL + 'users/users/me/'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
|
@ -56,8 +51,7 @@ export default {
|
||||||
actions: {
|
actions: {
|
||||||
// Send a request to the login URL and save the returned JWT
|
// Send a request to the login URL and save the returned JWT
|
||||||
login ({commit, dispatch, state}, {next, credentials, onError}) {
|
login ({commit, dispatch, state}, {next, credentials, onError}) {
|
||||||
let resource = Vue.resource(LOGIN_URL)
|
return axios.post('token/', credentials).then(response => {
|
||||||
return resource.save({}, credentials).then(response => {
|
|
||||||
logger.default.info('Successfully logged in as', credentials.username)
|
logger.default.info('Successfully logged in as', credentials.username)
|
||||||
commit('token', response.data.token)
|
commit('token', response.data.token)
|
||||||
commit('username', credentials.username)
|
commit('username', credentials.username)
|
||||||
|
@ -92,8 +86,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchProfile ({commit, dispatch, state}) {
|
fetchProfile ({commit, dispatch, state}) {
|
||||||
let resource = Vue.resource(USER_PROFILE_URL)
|
return axios.get('users/users/me/').then((response) => {
|
||||||
return resource.get({}).then((response) => {
|
|
||||||
logger.default.info('Successfully fetched user profile')
|
logger.default.info('Successfully fetched user profile')
|
||||||
let data = response.data
|
let data = response.data
|
||||||
commit('profile', data)
|
commit('profile', data)
|
||||||
|
@ -108,8 +101,7 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshToken ({commit, dispatch, state}) {
|
refreshToken ({commit, dispatch, state}) {
|
||||||
let resource = Vue.resource(REFRESH_TOKEN_URL)
|
return axios.post('token/refresh/', {token: state.token}).then(response => {
|
||||||
return resource.save({}, {token: state.token}).then(response => {
|
|
||||||
logger.default.info('Refreshed auth token')
|
logger.default.info('Refreshed auth token')
|
||||||
commit('token', response.data.token)
|
commit('token', response.data.token)
|
||||||
}, response => {
|
}, response => {
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import Vue from 'vue'
|
import axios from 'axios'
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
const REMOVE_URL = config.API_URL + 'favorites/tracks/remove/'
|
|
||||||
const FAVORITES_URL = config.API_URL + 'favorites/tracks/'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
|
@ -35,16 +31,14 @@ export default {
|
||||||
set ({commit, state}, {id, value}) {
|
set ({commit, state}, {id, value}) {
|
||||||
commit('track', {id, value})
|
commit('track', {id, value})
|
||||||
if (value) {
|
if (value) {
|
||||||
let resource = Vue.resource(FAVORITES_URL)
|
return axios.post('favorites/tracks/', {'track': id}).then((response) => {
|
||||||
resource.save({}, {'track': id}).then((response) => {
|
|
||||||
logger.default.info('Successfully added track to favorites')
|
logger.default.info('Successfully added track to favorites')
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
logger.default.info('Error while adding track to favorites')
|
logger.default.info('Error while adding track to favorites')
|
||||||
commit('track', {id, value: !value})
|
commit('track', {id, value: !value})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let resource = Vue.resource(REMOVE_URL)
|
return axios.post('favorites/tracks/remove/', {'track': id}).then((response) => {
|
||||||
resource.delete({}, {'track': id}).then((response) => {
|
|
||||||
logger.default.info('Successfully removed track from favorites')
|
logger.default.info('Successfully removed track from favorites')
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
logger.default.info('Error while removing track from favorites')
|
logger.default.info('Error while removing track from favorites')
|
||||||
|
@ -57,9 +51,8 @@ export default {
|
||||||
},
|
},
|
||||||
fetch ({dispatch, state, commit}, url) {
|
fetch ({dispatch, state, commit}, url) {
|
||||||
// will fetch favorites by batches from API to have them locally
|
// will fetch favorites by batches from API to have them locally
|
||||||
url = url || FAVORITES_URL
|
url = url || 'favorites/tracks/'
|
||||||
let resource = Vue.resource(url)
|
return axios.get(url).then((response) => {
|
||||||
resource.get().then((response) => {
|
|
||||||
logger.default.info('Fetched a batch of ' + response.data.results.length + ' favorites')
|
logger.default.info('Fetched a batch of ' + response.data.results.length + ' favorites')
|
||||||
response.data.results.forEach(result => {
|
response.data.results.forEach(result => {
|
||||||
commit('track', {id: result.track, value: true})
|
commit('track', {id: result.track, value: true})
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import Vue from 'vue'
|
import axios from 'axios'
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
import time from '@/utils/time'
|
import time from '@/utils/time'
|
||||||
|
|
||||||
|
@ -70,9 +69,7 @@ export default {
|
||||||
commit('playing', !state.playing)
|
commit('playing', !state.playing)
|
||||||
},
|
},
|
||||||
trackListened ({commit}, track) {
|
trackListened ({commit}, track) {
|
||||||
let url = config.API_URL + 'history/listenings/'
|
return axios.post('history/listenings/', {'track': track.id}).then((response) => {}, (response) => {
|
||||||
let resource = Vue.resource(url)
|
|
||||||
resource.save({}, {'track': track.id}).then((response) => {}, (response) => {
|
|
||||||
logger.default.error('Could not record track in history')
|
logger.default.error('Could not record track in history')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
import Vue from 'vue'
|
import axios from 'axios'
|
||||||
import config from '@/config'
|
|
||||||
import logger from '@/logging'
|
import logger from '@/logging'
|
||||||
|
|
||||||
const CREATE_RADIO_URL = config.API_URL + 'radios/sessions/'
|
|
||||||
const GET_TRACK_URL = config.API_URL + 'radios/tracks/'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
state: {
|
state: {
|
||||||
|
@ -39,13 +35,12 @@ export default {
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
start ({commit, dispatch}, {type, objectId, customRadioId}) {
|
start ({commit, dispatch}, {type, objectId, customRadioId}) {
|
||||||
let resource = Vue.resource(CREATE_RADIO_URL)
|
|
||||||
var params = {
|
var params = {
|
||||||
radio_type: type,
|
radio_type: type,
|
||||||
related_object_id: objectId,
|
related_object_id: objectId,
|
||||||
custom_radio: customRadioId
|
custom_radio: customRadioId
|
||||||
}
|
}
|
||||||
resource.save({}, params).then((response) => {
|
return axios.post('radios/sessions/', params).then((response) => {
|
||||||
logger.default.info('Successfully started radio ', type)
|
logger.default.info('Successfully started radio ', type)
|
||||||
commit('current', {type, objectId, session: response.data.id, customRadioId})
|
commit('current', {type, objectId, session: response.data.id, customRadioId})
|
||||||
commit('running', true)
|
commit('running', true)
|
||||||
|
@ -62,12 +57,10 @@ export default {
|
||||||
if (!state.running) {
|
if (!state.running) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let resource = Vue.resource(GET_TRACK_URL)
|
|
||||||
var params = {
|
var params = {
|
||||||
session: state.current.session
|
session: state.current.session
|
||||||
}
|
}
|
||||||
let promise = resource.save({}, params)
|
return axios.post('radios/tracks/', params).then((response) => {
|
||||||
promise.then((response) => {
|
|
||||||
logger.default.info('Adding track to queue from radio')
|
logger.default.info('Adding track to queue from radio')
|
||||||
dispatch('queue/append', {track: response.data.track}, {root: true})
|
dispatch('queue/append', {track: response.data.track}, {root: true})
|
||||||
}, (response) => {
|
}, (response) => {
|
||||||
|
|
Loading…
Reference in New Issue