feat: replace ohmyfetch with ofetch

This commit is contained in:
wobsoriano
2022-12-20 20:13:48 -08:00
parent 8168a46985
commit 7995e892db
7 changed files with 12 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useClient, useClientHeaders, useAsyncQuery } from '#imports'
import { useAsyncQuery, useClient, useClientHeaders } from '#imports'
const client = useClient()
const headers = useClientHeaders()
const { data: todos, pending, error, refresh } = await useAsyncQuery(['getTodos'])

View File

@@ -1,5 +1,5 @@
<script setup lang="ts">
import { useRoute, useAsyncQuery } from '#imports'
import { useAsyncQuery, useRoute } from '#imports'
const route = useRoute()
const { data: todo, pending, error } = await useAsyncQuery(['getTodo', Number(route.params.id)])
</script>

View File

@@ -29,7 +29,6 @@ export const router = trpc.router<Context>()
.mutation('addTodo', {
input: TodoShape,
async resolve(req) {
console.log(req.input)
return await $fetch<Todo>(`${baseURL}/todos`, {
method: 'POST',
body: req.input,
@@ -43,7 +42,7 @@ export async function createContext(event: H3Event) {
// This is just an example of something you'd might want to do in your ctx fn
// const x = useCookies(event)
console.log(event.req.headers)
console.log(event.node.req.headers)
return {