updatePlanningVersions.ts 676 B

1234567891011121314151617181920
  1. import { MutationTypes } from "@/store/Mutations";
  2. import { defineComponent } from "vue";
  3. const API_URL = process.env.VUE_APP_API_URL;
  4. export default defineComponent({
  5. methods: {
  6. updatePlanningVersions() {
  7. fetch(`${API_URL}api/evenements/history/${this.$store.state.evenement.uuid}`)
  8. .then((response) => {
  9. if (response.status == 200) {
  10. return response.json();
  11. } else {
  12. throw new Error(response.statusText);
  13. }
  14. })
  15. .then((data) => this.$store.commit(MutationTypes.refreshVersion, data))
  16. .catch((err) => console.error("Error while getting planning history", err));
  17. },
  18. },
  19. });