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> <option :value="true">Public Playlist</option>
</select> </select>
<button <button
:disabled="!create_button_enabled" :disabled="!can_export"
@click.self="create_playlist()" @click.self="create_playlist()"
> >
Create Playlist Create Playlist
@ -83,6 +83,7 @@ export default {
id: null, id: null,
url: null, url: null,
}, },
exported_settings: null,
}}, }},
mounted() { mounted() {
let date = new Date(); let date = new Date();
@ -94,9 +95,22 @@ export default {
this.container = true; 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: { methods: {
create_playlist() { create_playlist() {
this.create_button_enabled = false;
// Generate payload object // Generate payload object
let payload = { let payload = {
@ -105,6 +119,8 @@ export default {
public: this.is_public public: this.is_public
}; };
this.exported_settings = payload;
// Create the Spotify playlist (no tracks yet) // Create the Spotify playlist (no tracks yet)
axios.post( axios.post(
`${this.api_url}/users/${this.user_id}/playlists`, `${this.api_url}/users/${this.user_id}/playlists`,