Skip to content

JavaScript Module - LoginRequest doesn't seem to work #2892

@cwbuecheler

Description

@cwbuecheler

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?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions