Commit a3b49ed3 authored by SpinShare's avatar SpinShare

fixed api references to be a oneliner

parent 1498120e
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"description": "SpinSha.re Client", "description": "SpinSha.re Client",
"homepage": "https://spinsha.re", "homepage": "https://spinsha.re",
"copyright": "Copyright © SpinSha.re", "copyright": "Copyright © SpinSha.re",
"version": "2.2.2", "version": "2.2.3",
"author": "SpinSha.re", "author": "SpinSha.re",
"private": true, "private": true,
"scripts": { "scripts": {
......
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
this.$data.isUpdateAvailable = false; this.$data.isUpdateAvailable = false;
}); });
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getLatestVersion().then((data) => { ssapi.getLatestVersion().then((data) => {
if(data.stringVersion != app.getVersion() && process.env.NODE_ENV !== 'development') { if(data.stringVersion != app.getVersion() && process.env.NODE_ENV !== 'development') {
......
const axios = require('axios'); const axios = require('axios');
class SSAPI { class SSAPI {
constructor(isDev) { isDev() {
if(isDev) { if(process.env.NODE_ENV !== 'development') {
return false;
} else {
return false;
}
}
constructor() {
if(this.isDev()) {
this.apiBase = "http://localhost/www/spinshare/server/public/index.php/api/"; this.apiBase = "http://localhost/www/spinshare/server/public/index.php/api/";
} else { } else {
this.apiBase = "https://spinsha.re/api/"; this.apiBase = "https://spinsha.re/api/";
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
}, },
methods: { methods: {
refreshLibrary: async function() { refreshLibrary: async function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
let userSettings = new UserSettings(); let userSettings = new UserSettings();
this.$data.hasUnusedFiles = false; this.$data.hasUnusedFiles = false;
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,7 @@
this.$parent.$parent.$emit('install'); this.$parent.$parent.$emit('install');
}, },
getSongDetail: async function(filePath) { getSongDetail: async function(filePath) {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
let trackInfo = {}; let trackInfo = {};
let fileReference = path.basename(filePath).replace(".srtb", ""); let fileReference = path.basename(filePath).replace(".srtb", "");
......
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
}, 500); }, 500);
}, },
searchAll: function() { searchAll: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
this.$data.searchQuery == ""; this.$data.searchQuery == "";
this.$data.apiFinished = false; this.$data.apiFinished = false;
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
}); });
}, },
search: function() { search: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
this.$data.apiFinished = false; this.$data.apiFinished = false;
if(this.$data.searchQuery != "") { if(this.$data.searchQuery != "") {
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
this.$i18n.locale = this.$data.settingLanguage; this.$i18n.locale = this.$data.settingLanguage;
}, },
CheckForUpdates: function() { CheckForUpdates: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getLatestVersion().then((data) => { ssapi.getLatestVersion().then((data) => {
if(data.stringVersion != app.getVersion() && process.env.NODE_ENV !== 'development') { if(data.stringVersion != app.getVersion() && process.env.NODE_ENV !== 'development') {
......
...@@ -173,7 +173,7 @@ ...@@ -173,7 +173,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
let userSettings = new UserSettings(); let userSettings = new UserSettings();
ssapi.getSongDetail(this.$route.params.id).then((data) => { ssapi.getSongDetail(this.$route.params.id).then((data) => {
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getSongDetailReviews(this.$route.params.id).then((data) => { ssapi.getSongDetailReviews(this.$route.params.id).then((data) => {
if(data.status == 200) { if(data.status == 200) {
......
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getSongDetailSpinPlays(this.$route.params.id).then((data) => { ssapi.getSongDetailSpinPlays(this.$route.params.id).then((data) => {
if(data.status == 200) { if(data.status == 200) {
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getPromos().then((data) => { ssapi.getPromos().then((data) => {
this.$data.isPromoLoading = false; this.$data.isPromoLoading = false;
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getHotSongs(this.$data.hotSongsOffset).then((data) => { ssapi.getHotSongs(this.$data.hotSongsOffset).then((data) => {
this.$data.isHotSongsLoading = false; this.$data.isHotSongsLoading = false;
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
} }
}, },
updateHot: function() { updateHot: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
this.$data.isHotSongsLoading = true; this.$data.isHotSongsLoading = true;
ssapi.getHotSongs(this.$data.hotSongsOffset).then((data) => { ssapi.getHotSongs(this.$data.hotSongsOffset).then((data) => {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getNewSongs(this.$data.newSongsOffset).then((data) => { ssapi.getNewSongs(this.$data.newSongsOffset).then((data) => {
this.$data.isNewSongsLoading = false; this.$data.isNewSongsLoading = false;
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
} }
}, },
updateNew: function() { updateNew: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
this.$data.isNewSongsLoading = true; this.$data.isNewSongsLoading = true;
ssapi.getNewSongs(this.$data.newSongsOffset).then((data) => { ssapi.getNewSongs(this.$data.newSongsOffset).then((data) => {
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getPopularSongs(this.$data.popularSongsOffset).then((data) => { ssapi.getPopularSongs(this.$data.popularSongsOffset).then((data) => {
this.$data.isPopularSongsLoading = false; this.$data.isPopularSongsLoading = false;
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
} }
}, },
updatePopular: function() { updatePopular: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
this.$data.isPopularSongsLoading = true; this.$data.isPopularSongsLoading = true;
ssapi.getPopularSongs(this.$data.popularSongsOffset).then((data) => { ssapi.getPopularSongs(this.$data.popularSongsOffset).then((data) => {
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
} }
}, },
mounted: function() { mounted: function() {
let ssapi = new SSAPI(process.env.NODE_ENV === 'development'); let ssapi = new SSAPI();
ssapi.getUserDetail(this.$route.params.id).then((data) => { ssapi.getUserDetail(this.$route.params.id).then((data) => {
if(data.status == 200) { if(data.status == 200) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment