File

src/login.ts

Constructor

constructor(conf: { endpoint?: string; })

Methods

Public login
login(username: string, password: string)
Returns: void

Properties

Protected client
client: AxiosInstance
Default value: axios

Request Client

Protected endpoint
endpoint: string
Default value: DEFAULT_ENDPOINT

Shifter API Endpoint

import axios, { AxiosInstance } from 'axios';
import { DEFAULT_ENDPOINT } from './client';

export class Login {
  /**
   * Request Client
   */
  protected readonly client: AxiosInstance = axios;

  /**
   * Shifter API Endpoint
   */
  protected readonly endpoint: string = DEFAULT_ENDPOINT;

  constructor(conf?: { endpoint?: string }) {
    if (conf && conf.endpoint) this.endpoint = conf.endpoint;
  }

  public async login(username: string, password: string) {
    const result = await this.client.post(`${this.endpoint}/login`, {
      username,
      password,
    });
    return result.data;
  }
}

results matching ""

    No results matching ""