replace all $fetch with useRequestFetch
This commit is contained in:
parent
015b66706f
commit
eabb7b89c7
5 changed files with 22 additions and 22 deletions
|
@ -1,6 +1,4 @@
|
|||
<script setup lang="ts">
|
||||
/* global $fetch */
|
||||
import { useRoute, useFetch, createError } from "nuxt/app";
|
||||
import { ref, type Ref } from "vue";
|
||||
|
||||
import { VBtn, VForm } from "vuetify/components";
|
||||
|
@ -9,7 +7,10 @@ import Snowflake from "~/utils/snowflake";
|
|||
import OrderView from "~/components/orderView.vue";
|
||||
import EntryEditor, { type fieldDefinition } from "~/components/entryEditor.vue";
|
||||
|
||||
import { useRoute, useFetch, createError, useRequestFetch } from "#imports";
|
||||
|
||||
const route = useRoute();
|
||||
const fetch = useRequestFetch();
|
||||
const id = route.params.id;
|
||||
|
||||
const clientRequest = await useFetch(`/api/clients/${id}` as "/api/clients/:id");
|
||||
|
@ -38,7 +39,7 @@ async function loadOrder(id: string) {
|
|||
if (!entry) throw createError(`excepted order entry for ${id}`);
|
||||
entry.loading = true;
|
||||
// @ts-expect-error
|
||||
entry.value = await $fetch(`/api/orders/${id}` as "/api/order/:id", {
|
||||
entry.value = await fetch(`/api/orders/${id}` as "/api/order/:id", {
|
||||
method: "GET",
|
||||
}) as Order;
|
||||
entry.loading = false;
|
||||
|
@ -77,7 +78,7 @@ async function handleSubmit() {
|
|||
submitting.value = true;
|
||||
normalizeForm();
|
||||
try {
|
||||
const result = await $fetch(
|
||||
const result = await fetch(
|
||||
`/api/clients/${client.value.id}` as "/api/clients/:id", {
|
||||
method: "PATCH",
|
||||
body: formData.value,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue