Greets,
I used swagger-codegen to generate a node module that I could then reference in my React project. This worked fine and I have it up and running, however the LoginRequest method doesn't appear to be working right. I just want to make sure I have the syntax correct. The following code always sends an empty body to the server, resulting in a 500 error. Is there something wrong with it?
(note: the auth info is obviously fake, but even with fake creds it should return a 401, not a 500 -- with the real creds, it's still a 500 because they're never being sent)
import SwaggerJsClient from 'swagger-js-client';
const api = new SwaggerJsClient.DefaultApi()
const opts = {
'body': new SwaggerJsClient.LoginRequest({ email: 'test@test.com', password: 'testme' }),
};
const callback = (error, data, response) => {
console.log('error: ', error);
console.log('data: ', data);
console.log('response: ', response);
};
api.login(opts, callback);
If I skip using the LoginRequest() method and just do the following, it works:
const opts = {
'body': {
'email': 'test@test.com',
'password': 'testme',
},
};
I've looked through the docs, I've tried using JSON.stringify() on the data I'm passing to LoginRequest(), and even tried to do some testing on LoginRequest.js but haven't been able to figure out what the problem is. Any ideas?
Greets,
I used swagger-codegen to generate a node module that I could then reference in my React project. This worked fine and I have it up and running, however the
LoginRequestmethod doesn't appear to be working right. I just want to make sure I have the syntax correct. The following code always sends an empty body to the server, resulting in a 500 error. Is there something wrong with it?(note: the auth info is obviously fake, but even with fake creds it should return a 401, not a 500 -- with the real creds, it's still a 500 because they're never being sent)
If I skip using the
LoginRequest()method and just do the following, it works:I've looked through the docs, I've tried using
JSON.stringify()on the data I'm passing toLoginRequest(), and even tried to do some testing onLoginRequest.jsbut haven't been able to figure out what the problem is. Any ideas?