0

I am using NSwagStudio to generate a client class for a React app. I'm generating a client interface so that I can use test data to provide to the application through another implementation of the client. I would like to start implementing cancellation when the React component unmounts as this seems like a better idea than using the 'IsMounted' system. The issue is that the cancel token shows up in the actual implementations like this:

refreshToken(userId: string, refreshToken: string , cancelToken?: CancelToken | undefined): Promise<AuthData> {
    ...the method...
}

That's great, except that to be able to switch data sources easily between test and production I'm only using the interface definition, which looks like this:

refreshToken(userId: string, refreshToken: string): Promise<AuthData>;

No cancellation...

Is there a way to tell NSwag to put the cancellation token in there? Or another way to cancel that I'm missing?

sfaust
  • 2,089
  • 28
  • 54

0 Answers0