Skip to content

Commit

Permalink
fix: results url
Browse files Browse the repository at this point in the history
  • Loading branch information
EvaMart committed Jan 23, 2023
1 parent e94c2e8 commit b83751a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 4 additions & 2 deletions pages/discover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export default {
// },
// fetch the data when the view is created and the data is
// already being observed
// { immediate: true }
// { immediate: false }
//)
},
computed: {
Expand Down Expand Up @@ -121,8 +121,10 @@ export default {
async checkIdInParameters(){
// Check if id is queried
// If it is, fetch the results from the API
// ⚒️ console.log('Checking parameters: ', this.$route)
console.log('Checking parameters: ', this.$route)
if(this.$route.query.id!=undefined){
console.log('Fetching results by id: ', this.$route.query.id)
this.$store.dispatch('fetchResultsById', this.$route.query.id)
}
},
Expand Down
17 changes: 8 additions & 9 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import Vuex from "vuex";
import axios from "axios";
import VueAxios from "vue-axios";
import createCache from "vuex-cache";
import route from "vue-router";

Vue.use(Vuex);
Vue.use(VueAxios, axios);




// central store
export const state = () => ({
query: true,
Expand Down Expand Up @@ -66,17 +65,17 @@ export const actions = {
commit('setQuery', true);
commit('setQuerying', true);

console.log('fetchResultsById')

await this.cache.dispatch('GET_RESULTS_BY_ID', Id);
await this.dispatch('GET_RESULTS_BY_ID', Id);

commit('setQuerying', false);

},

async GET_RESULTS_BY_ID({commit, state}, Id){
//var URL = 'https://fair-tool-discoverer.bsc.es/api/result/fetch';
var URL = '/result/fetch'
await this.$axios.get(URL, {
console.log('GET_RESULTS_BY_ID')
await this.$axios.get( '/result/fetch' , {
params: {
id : Id
},
Expand All @@ -88,7 +87,8 @@ export const actions = {
console.log(response);
if(response.data.message.result_found==true){
commit('setResults', response.data.message)
commit('setResultsURL', response.data.message.run_id);

commit('setResultsURL', Id);
}
commit('setResultsNotFound', !response.data.message.result_found);
})
Expand Down Expand Up @@ -155,8 +155,7 @@ export const mutations = {
state.results = results;
},
setResultsURL(state, run_id){
const nuxtURL = 'http://localhost:3000/';
const resultsURL = nuxtURL + 'discover?id=' + run_id;
const resultsURL = window.location.origin + '/discover?id=' + run_id;
state.resultsURL = resultsURL;
},
setResultsNotFound(state, resultsNotFound){
Expand Down

0 comments on commit b83751a

Please sign in to comment.