diff --git a/_redirects b/_redirects new file mode 100644 index 0000000..7797f7c --- /dev/null +++ b/_redirects @@ -0,0 +1 @@ +/* /index.html 200 diff --git a/package.json b/package.json index 6ed0237..9342cda 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build", + "build": "vue-cli-service build && mv ./_redirects ./dist/_redirects", "lint": "vue-cli-service lint", "test:e2e": "vue-cli-service test:e2e", "test:unit": "vue-cli-service test:unit", diff --git a/src/store.js b/src/store.js index bf5bb21..1331aa3 100644 --- a/src/store.js +++ b/src/store.js @@ -8,7 +8,7 @@ Vue.use(VueAxios, axios) let github_apiURL = 'https://api.github.com/repos' //let path = '/repos/ChallengeHunt/challengehunt' -const Backend_API_URL = 'http://127.0.0.1:5000/api' +const Backend_API_URL = 'https://dribdat2.herokuapp.com/api' export default new Vuex.Store({ state: { @@ -110,27 +110,34 @@ export default new Vuex.Store({ }, loadProject ({ commit }) { axios - .get('http://127.0.0.1:5000/api/project/' + '1' + '/info.json') + .get(`${Backend_API_URL}/project/1/info.json`) .then(r => r.data) .then(project => { commit('SET_PROJECT', project) }) }, - loadCustomProject ({ commit }, id) { + loadCustomProject({commit}, id) { axios - .get('http://127.0.0.1:5000/api/project/' + id + '/info.json') + .get( `${Backend_API_URL}/project/${id}/info.json`, { + method: 'GET', + mode: 'no-cors', + headers: { + 'Access-Control-Allow-Origin': '*', + 'Content-Type': 'application/json', + } + }) .then(r => r.data) .then(custom_project => { commit('SET_CUSTOM_PROJECT', custom_project) }) }, - loadProjectList ({ commit }, event) { + loadProjectList({commit},event) { let eventId = event || 'current' - var url = `${Backend_API_URL}/event/${eventId}/challenges.json` + var url = `${Backend_API_URL}/event/${eventId}/projects.json` - if (eventId === 'current') { - url = `${Backend_API_URL}/event/current/challenges.json`; + if(eventId === 'current'){ + url = `${Backend_API_URL}/event/current/projects.json` ; } axios @@ -143,14 +150,14 @@ export default new Vuex.Store({ } }) .then(response => { - commit('SET_PROJECT_LIST', response.data.challenges) + commit('SET_PROJECT_LIST', response.data.projects) }) }, - setModeEdit ({ commit }) { + setModeEdit({commit}){ commit('SET_EDITABLE', true) }, - setModeDisplay ({ commit }) { + setModeDisplay({commit}){ commit('SET_EDITABLE', false) }, setProjectProgress ({ commit }, progress) {