UNPKG

@tapis/tapisui-api

Version:

Typescript library for making api calls with react query

17 lines (16 loc) 560 B
import { Authenticator } from '@tapis/tapis-typescript'; import { apiGenerator, errorDecoder } from '../utils'; // This helper takes the username and password and assembles an API call const login = (username, password, basePath) => { const reqCreateToken = { username, password, grant_type: 'password', }; const request = { reqCreateToken, }; const api = apiGenerator(Authenticator, Authenticator.TokensApi, basePath, null); return errorDecoder(() => api.createToken(request)); }; export default login;