Extract baseurl

This commit is contained in:
Peter Stuifzand 2018-08-28 22:25:46 +02:00
parent 2d1b21b804
commit 4450a2dc16

View File

@ -1,6 +1,7 @@
import Vue from 'vue' import Vue from 'vue'
import Vuex from 'vuex' import Vuex from 'vuex'
const baseurl = "https://microsub.stuifzandapp.com/microsub"
Vue.use(Vuex) Vue.use(Vuex)
@ -42,7 +43,7 @@ export default new Vuex.Store({
actions: { actions: {
fetchChannels({commit}) { fetchChannels({commit}) {
fetch('https://microsub.stuifzandapp.com/microsub?action=channels', { fetch(baseurl + '?action=channels', {
headers: { headers: {
'Authorization': 'Bearer ' + this.state.access_token 'Authorization': 'Bearer ' + this.state.access_token
} }
@ -56,7 +57,7 @@ export default new Vuex.Store({
commit('clearTimeline', {channel: channel}) commit('clearTimeline', {channel: channel})
}, },
fetchTimeline({commit}, channel) { fetchTimeline({commit}, channel) {
let url = 'https://microsub.stuifzandapp.com/microsub?action=timeline&channel=' + channel.uid let url = baseurl + '?action=timeline&channel=' + channel.uid
if (channel.after) { if (channel.after) {
url += '&after=' + channel.after; url += '&after=' + channel.after;
} }
@ -83,7 +84,7 @@ export default new Vuex.Store({
commit('newAccessToken', response) commit('newAccessToken', response)
}, },
markRead(x, {channel, entry}) { markRead(x, {channel, entry}) {
let url = 'https://microsub.stuifzandapp.com/microsub?action=timeline&method=mark_read&channel=' + encodeURIComponent(channel) + '&entry=' + encodeURIComponent(entry); let url = baseurl + '?action=timeline&method=mark_read&channel=' + encodeURIComponent(channel) + '&entry=' + encodeURIComponent(entry);
return fetch(url, { return fetch(url, {
method: 'POST', method: 'POST',
headers: { headers: {