Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
AURA
dashboard
Commits
f0fc01d0
Commit
f0fc01d0
authored
May 15, 2019
by
jackie / Andrea Ida Malkah Klaura
Browse files
FEAT: implement storing of new/updated playlists
parent
1c246b6e
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/FileManager.vue
View file @
f0fc01d0
...
@@ -891,11 +891,44 @@ export default {
...
@@ -891,11 +891,44 @@ export default {
this
.
$bvModal
.
show
(
'
modal-edit-playlist
'
)
this
.
$bvModal
.
show
(
'
modal-edit-playlist
'
)
},
},
// Adds a new or updates an existing playlist by sending a POST/PUT
// request to the AURA tank API
storePlaylist
:
function
()
{
storePlaylist
:
function
()
{
this
.
notYetImplemented
()
var
data
=
{
entries
:
this
.
playlistEditor
.
entries
}
var
data
=
{
entries
:
this
.
playlistEditor
.
entries
}
console
.
log
(
'
Attempting to send playlist data:
'
)
var
uri
=
process
.
env
.
VUE_APP_API_TANK
+
'
shows/
'
+
this
.
shows
[
this
.
currentShow
].
slug
+
'
/playlists
'
console
.
log
(
JSON
.
stringify
(
data
))
// TODO: add some spinner or other visualisation while the playlist is added/updated
if
(
this
.
playlistEditor
.
mode
===
'
add
'
)
{
axios
.
post
(
uri
,
data
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
user
.
access_token
}
}).
then
(
response
=>
{
this
.
playlists
.
push
(
response
.
data
)
}).
catch
(
error
=>
{
console
.
log
(
'
Error:
'
+
error
.
response
.
status
+
'
'
+
error
.
response
.
statusText
)
console
.
log
(
error
.
response
)
alert
(
'
Error: could not add new playlist. See console log for details.
'
)
})
// when updating an existing playlist we use a PUT request and add the id
// of the playlist to the uri
}
else
if
(
this
.
playlistEditor
.
mode
===
'
edit
'
)
{
uri
+=
'
/
'
+
this
.
playlistEditor
.
id
axios
.
put
(
uri
,
data
,
{
withCredentials
:
true
,
headers
:
{
'
Authorization
'
:
'
Bearer
'
+
this
.
$parent
.
user
.
access_token
}
}).
then
(
response
=>
{
// TODO: seems to be not implemented in the tank yet
// update this as soon as tank has it implemented
//this.playlists.push(response.data)
console
.
log
(
response
.
data
)
}).
catch
(
error
=>
{
console
.
log
(
'
Error:
'
+
error
.
response
.
status
+
'
'
+
error
.
response
.
statusText
)
console
.
log
(
error
.
response
)
alert
(
'
Error: could not update playlist. See console log for details.
'
)
})
}
},
},
// To start modifying the meta information for a file we have to set our
// To start modifying the meta information for a file we have to set our
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment