0
0
Fork 0

Begin work on preventing the playlist creation if the conditions are not met

This commit is contained in:
Oliver-Akins 2020-08-15 15:27:51 -06:00
parent eaf49dd3ea
commit f18db8a275

View file

@ -33,7 +33,7 @@
<option :value="true">Public Playlist</option>
</select>
<button
:disabled="!create_button_enabled"
:disabled="!can_export"
@click.self="create_playlist()"
>
Create Playlist
@ -83,6 +83,7 @@ export default {
id: null,
url: null,
},
exported_settings: null,
}},
mounted() {
let date = new Date();
@ -94,9 +95,22 @@ export default {
this.container = true;
});
},
computed: {
can_export() {
// Spotify has a name length of 100 characters, ensure we don't error
if (this.name.length > 100) {
return false;
};
if (this.exported_settings) {
};
return true;
}
},
methods: {
create_playlist() {
this.create_button_enabled = false;
// Generate payload object
let payload = {
@ -105,6 +119,8 @@ export default {
public: this.is_public
};
this.exported_settings = payload;
// Create the Spotify playlist (no tracks yet)
axios.post(
`${this.api_url}/users/${this.user_id}/playlists`,