Skip to content

Instantly share code, notes, and snippets.

@cp-sumi-k
Last active June 27, 2022 04:22
Show Gist options
  • Save cp-sumi-k/ad5073986b22437c9e79391d9c16afec to your computer and use it in GitHub Desktop.
Save cp-sumi-k/ad5073986b22437c9e79391d9c16afec to your computer and use it in GitHub Desktop.
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