diff --git a/.playground/app.vue b/.playground/app.vue index d3b4b2e..430d9d9 100644 --- a/.playground/app.vue +++ b/.playground/app.vue @@ -3,7 +3,7 @@ diff --git a/components/FetchForm.vue b/components/FetchForm.vue index 3b02226..2b1f49d 100644 --- a/components/FetchForm.vue +++ b/components/FetchForm.vue @@ -125,14 +125,17 @@ function onSubmit(e) { // Get mockup response if (props.mockupResponse) { const data = typeof props.mockupResponse === 'function' ? props.mockupResponse?.(payload) : props.mockupResponse; - emit('fetch', null); - emit('response', data); - emit('response:full', { data }); - emit('complete', true); - - currentResponse.value = props.mockupResponse; - currentError.value = null; - isFetching.value = false; + emit('fetch', new Promise((resolve) => { + emit('response', data); + emit('response:full', { meta: { code: 200 }, data, error: null }); + emit('complete', true); + + resolve({ meta: { code: 200 }, data, error: null }); + + currentResponse.value = props.mockupResponse; + currentError.value = null; + isFetching.value = false; + })); return; } diff --git a/package.json b/package.json index d912c19..fe40b08 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@limbo-works/fetch-form", "type": "module", - "version": "0.1.0", + "version": "0.1.1", "main": "./nuxt.config.js", "scripts": { "dev": "nuxi dev .playground",