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/a1ce3bb644c511e97320bf25e67ac6ec to your computer and use it in GitHub Desktop.
Save cp-sumi-k/a1ce3bb644c511e97320bf25e67ac6ec to your computer and use it in GitHub Desktop.
import { defineStore } from "pinia";
import axios from "axios";
export const useJobDetailStore = defineStore("job-detail", {
state: () => {
return {
item: null,
error: null,
};
},
actions: {
getJobById(id) {
return new Promise((resolve) => {
axios
.get(BASE_API_URL + "/api/careers/" + id)
.then((response) => {
this.item = 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