Skip to content

Commit

Permalink
add: cookie
Browse files Browse the repository at this point in the history
  • Loading branch information
leosin committed Jul 15, 2024
1 parent 70b918a commit 4affbfa
Show file tree
Hide file tree
Showing 11 changed files with 5,931 additions and 4,870 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
"repository": "@deeptimes/ezfetch",
"license": "MIT",
"type": "module",
"capabilities": {
"nuxt": "^3.10.0",
"node": ">18"
},
"exports": {
".": {
"types": "./dist/types.d.ts",
Expand All @@ -29,7 +33,8 @@
"test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
},
"dependencies": {
"@nuxt/kit": "^3.12.3"
"@nuxt/kit": "^3.12.3",
"defu": "^6.1.4"
},
"devDependencies": {
"@nuxt/devtools": "^1.3.9",
Expand Down
29 changes: 24 additions & 5 deletions playground/app.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
<script setup>
const result = ref()
const { data, pending } = await ezFetch('/items/blogs', {
params: {
fields: ['title'],
},
})
result.value = data.value?.data
console.log(result.value)
</script>
<template>
<div>
Nuxt module playground!
<div class="">
<div v-if="pending">
pending
</div>
<div v-else>
<p
v-for="(item, i) in result"
:key="i"
>
{{ item.title }}
</p>
</div>
</div>
</template>

<script setup>
</script>
13 changes: 12 additions & 1 deletion playground/nuxt.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
export default defineNuxtConfig({
modules: ['../src/module'],
ezFetch: {},
ezFetch: {
cookie: {
access: 'tk_access',
},
},
devtools: { enabled: true },
compatibilityDate: '2024-07-15',
runtimeConfig: {
apiSecret: process.env.NUXT_API_SECRET,
public: {
apiBase: process.env.NUXT_PUBLIC_API_BASE,
},
},
})
Loading

0 comments on commit 4affbfa

Please sign in to comment.