blue-veery-gmbh / spring-rest-2-ts

spring rest 2 ts is typescript generator which produces data model and services in typescript based on Spring MVC annotations. It supports generation for Angular and React
MIT License
64 stars 17 forks source link

Add async instruction on method using Promise #13

Closed slobberbone closed 2 years ago

slobberbone commented 4 years ago

First anything else : very good job ! Thank you ! I'm using FetchBasedImplementationGenerator to generate method like :

public addMyObject(arg0: MyObject): Promise<MyObject>  {
   const url =  new URL('/api/myObject/add', this.baseURL);
   return fetch(url.toString(), {method: 'GET'}).then(res =>  res.json());
  }

I would like to add "async" instruction like :

public **async** addMyObject(arg0: MyObject): Promise<MyObject>  {
   const url =  new URL('/api/myObject/add', this.baseURL);
   return fetch(url.toString(), {method: 'GET'}).then(res =>  res.json());
}
tomasz-wozniak75 commented 4 years ago

Hi, thanks :) We will add async as an option to FetchBasedImplementationGenerator Tomasz

tomasz-wozniak75 commented 4 years ago

Now TSMethod has option to set async modifier which is set by FetchBasedImplementationGenerator if it is configured to do it. Change has been released

tomasz-wozniak75 commented 2 years ago

done