Last active
June 27, 2022 04:22
-
-
Save cp-sumi-k/ad5073986b22437c9e79391d9c16afec 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
import { defineStore } from "pinia"; | |
import axios from "axios"; | |
export const useJobListStore = defineStore("jobs", { | |
state: () => { | |
return { | |
items: null, | |
error: null, | |
}; | |
}, | |
actions: { | |
getJobs() { | |
return new Promise((resolve) => { | |
axios | |
.get(BASE_API_URL + "/api/careers") | |
.then((response) => { | |
this.items = response.data; | |
resolve(); | |
}) | |
.catch((error) => { | |
this.error = error; | |
resolve(); | |
}); | |
}); | |
}, | |
}, | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment