Giter VIP home page Giter VIP logo

Comments (18)

mrlubos avatar mrlubos commented on August 10, 2024 1

@grifondopala no, you will want to pass the native Fetch API option which is credentials. If you play with the StackBlitz example, you can see it's autocompleted in createClient(). withCredentials is the Axios API.

from openapi-ts.

grifondopala avatar grifondopala commented on August 10, 2024 1

@mrlubos Than you!
createClient({ credentials: "include" })
works for me

from openapi-ts.

grifondopala avatar grifondopala commented on August 10, 2024

Same question, but i am using client-fetch, and don't understand, how to set withCredentions to true. Need Help

from openapi-ts.

soonoo avatar soonoo commented on August 10, 2024

I haven't tried it yet, but I see that the generated code is exporting an configuration object named OpenAPI. It seems like importing and directly changing it is possible.

OpenAPI.WITH_CREDENTIALS = true

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

@grifondopala Are you using the legacy Fetch client or the standalone package?

from openapi-ts.

grifondopala avatar grifondopala commented on August 10, 2024

I am using @hey-api/client-fetch

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

@soonoo I believe you're right about being hard-coded. This would be addressed by a standalone Axios client

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

@grifondopala you can pass any Fetch API arguments to the client when you're creating it. You could even supply your own fetch instance

from openapi-ts.

grifondopala avatar grifondopala commented on August 10, 2024

@mrlubos you mean, that i should write
createClient({ withCredentials: true })
?

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

Hey @soonoo, if you're able to switch to the new Axios client, it's available there simply as passing withCredentials. More in the docs

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

I'm going to put a help wanted label on this as the new clients are a priority over maintaining the old ones

from openapi-ts.

dagadbm avatar dagadbm commented on August 10, 2024

i wanted to use the new ones as well but the typescript of 5x is a deal breaker it breaks a lot of dependencies.

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

Is it @dagadbm? Because the main package has the same requirement https://github.com/hey-api/openapi-ts/blob/main/packages/openapi-ts/package.json#L70

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

Or do you mean you can't use the openapi-ts package at all?

from openapi-ts.

dagadbm avatar dagadbm commented on August 10, 2024

I have the 0.33.2 version but I cannot update it any further because of the typescript.

I think the only thing that I can't do is mimick the axios error:

axios.interceptors.response.use(processData, processErrors);
OpenAPI.interceptors.response.use((request) => {
  if (request.status >= 200 || request.status <= 299) {
    return processData(request);
  } else {
    const error = new AxiosError<DatafoldError>(
      request.statusText,
      request.status,
      request.config,
      request.request,
      request,
    );
    return processErrors(error);
  }
});

i dont think things map out 1:1 from what I see.

But I won't take any more of your time. Its incredible how much stuff has ben evolving here.

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

@dagadbm I'll need to improve the Axios client, thanks for the feedback! That's a bummer about being stuck on v0.33.2, lots of good stuff since then. What kind of errors are you seeing? Any chance you know what has changed (presumably) in v0.34.0 that prevents you from upgrading?

from openapi-ts.

dagadbm avatar dagadbm commented on August 10, 2024

Its the typescript requirement of 5.0

I cannot update it on my side I get a whole bunch of other conflicts with other packages.

from openapi-ts.

mrlubos avatar mrlubos commented on August 10, 2024

Which version are you on?

from openapi-ts.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.