0
0
Fork 0

Implement a preview mode that bypasses the Spotify authentication and uses sample data.

This commit is contained in:
Tyler-A 2020-07-08 18:51:04 -06:00
parent 4a61eec9ff
commit ceebbb7b50
4 changed files with 39 additions and 5 deletions

View file

@ -0,0 +1,28 @@
let params = new URLSearchParams(window.location.search);
let dev_mode = !(params.get(`dev`) == null || params.get(`dev`) === `false`);
let preview = !(params.get(`preview`) == null || params.get(`preview`) === `false`);
function get_dev_data () {
switch (this.type) {
case `Artists`:
this.data.artists = dev_artists;
this.data.tracks = [];
break;
case `Tracks`:
this.data.artists = [];
this.data.tracks = dev_tracks;
break;
default:
this.data.tracks = [];
this.data.artists = [];
break;
}
}
if (dev_mode || preview) {
vue_config.data.user.name = `Preview Mode`;
vue_config.methods.get_data = get_dev_data;
vue_config.computed.is_authed = function () { return true; };
};