dotkom / AMaCS

Committee application application for Online online.
5 stars 2 forks source link

Fix/application service #37

Closed arwassa closed 7 years ago

arwassa commented 7 years ago

Moved application posting logic out of the Application component and into it's own service.

sklirg commented 7 years ago

Okay, I can try it out a bit and see if it catches what I expect 👌

On Sat, Aug 19, 2017, 17:17 Jarle Trollebø notifications@github.com wrote:

@Aborysa commented on this pull request.

In app/src/components/App/Application/index.jsx https://github.com/dotkom/supreme-guacamole/pull/37#discussion_r134094106 :

-

  • const json = await resp.json();
  • if (resp.status === 201) {
  • this.setState({
  • responseMessage: 'Søknad er sendt.',
  • });
  • return;
  • }
  • // Sometimes we get an array of messages and sometimes we get
  • // an object. If we get an array we can concat it together,
  • // if we get an object we show a more generic error message.
  • const errorMessage = json instanceof Array ? json : 'Pass pÃ¥ at du har fylt ut alle feltene og valgt komiteer Ã¥ søke.';
  • },(err) => {

It is based on the respon's ok param, if it isn't ok an error is thrown. That means all 4XX errors will be cough.

— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/dotkom/supreme-guacamole/pull/37#discussion_r134094106, or mute the thread https://github.com/notifications/unsubscribe-auth/AFK964xDMgswXd0ufN2yS7Yk6-B_Sih7ks5sZvx-gaJpZM4O8Vu_ .