<script setup>
import { defineProps } from 'vue'
const props = defineProps(['order_id'])
import { authenticatedRequest } from "@/components/session/authenticatedRequest.vue";
import LoadButtonWhileAwait from "@/components/request/LoadButtonWhileAwait.vue";
import { handleEconomicError } from "@/components/request/HandleEconomicError.vue";
import { ref } from "vue";

const removeOrderDraftInvoice = async () => {
  await authenticatedRequest('/economic/invoice/draft/delete?order_id=' + props.order_id,'delete',{
  }) .then((response) => {
    // Reload the page
    location.reload();
  }).catch((error) => {
    handleEconomicError(error);
  });
};
</script>

<template>
  <LoadButtonWhileAwait class="is-warning is-inverted" :loadFunction="removeOrderDraftInvoice" icon="fas fa-file-invoice"> Rediger kladden </LoadButtonWhileAwait>
</template>

<style scoped>

</style>