Last active
June 27, 2022 04:22
-
-
Save cp-sumi-k/fd5c969d0cc0380a0ecc3b7b7037e4d3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
vuex store actions | |
*/ | |
const actions = { | |
getJobs({ commit }) { | |
return new Promise((resolve, reject) => { | |
axios | |
.get(BASE_API_URL + "/api/careers") | |
.then((response) => { | |
commit("SET_JOBS", response.data); | |
resolve(response); | |
}) | |
.catch((error) => { | |
commit("SET_JOBS_ERROR", error); | |
reject(error); | |
}); | |
}); | |
}, | |
} | |
/* | |
pinia store actions | |
*/ | |
const actions = { | |
getJobs() { | |
return new Promise((resolve) => { | |
axios | |
.get(BASE_API_URL + "/api/careers") | |
.then((response) => { | |
//removed mutation and update store directly using this | |
this.items = response.data; | |
resolve(); | |
}) | |
.catch((error) => { | |
//removed mutation and update store directly using this | |
this.error = error; | |
resolve(); | |
}); | |
}); | |
}, | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment