storybook-addon-mock icon indicating copy to clipboard operation
storybook-addon-mock copied to clipboard

thank you -- this worked right away with no trouble (storybook, urql, vue3, graphql)

Open iambumblehead opened this issue 3 years ago • 4 comments

thank you! I initially tried using an urql-specific addon and there were many issues and it didn't work. I really like that its possible to generate dynamically created responses later if I need those

export const NORMAL = Template.bind({});
NORMAL.decorators = [ vueRouter() ];
NORMAL.parameters = {
  mockData: [{
    url: endpointUrl,
    method: 'POST',
    status: 200,
    response: {
      data: {
        getSelf: {
          id: 'id',
          name: 'name',
          email: 'email'
        }
      }
    }
  }]
};

iambumblehead avatar Aug 12 '22 18:08 iambumblehead

Hi @iambumblehead , Did you use fetch to perform your API call in your Vue component ? Or did you use axios ?

ECW-HH avatar Aug 16 '22 11:08 ECW-HH

@ECW-HH I don't know how urql ultimately generates the request but I'll take a look now

iambumblehead avatar Aug 16 '22 12:08 iambumblehead

https://github.com/FormidableLabs/urql/blob/main/packages/core/src/internal/fetchSource.ts#L26

I'm not sure where this "operation.context.fetch" is defined, but it is used to generate the urql request https://github.com/FormidableLabs/urql/blob/main/packages/core/src/internal/fetchSource.ts#L26

iambumblehead avatar Aug 16 '22 12:08 iambumblehead

https://github.com/FormidableLabs/urql/blob/main/docs/api/core.md this document indicates "window.fetch" is used

iambumblehead avatar Aug 16 '22 12:08 iambumblehead