Last active
June 27, 2022 04:22
-
-
Save cp-sumi-k/a1ce3bb644c511e97320bf25e67ac6ec 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 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