23 lines
555 B
TypeScript
23 lines
555 B
TypeScript
import { useEffect } from "react";
|
|
import { GenApi } from "../API/GenApi";
|
|
|
|
// Instantiation of the API
|
|
const api = new GenApi();
|
|
|
|
export function GenApiDemo(): JSX.Element {
|
|
// Sync wrapper around the loginCreate method
|
|
const register = async (): Promise<void> => {
|
|
const response = await api.login.loginCreate({
|
|
username: "admin",
|
|
password: "admin",
|
|
});
|
|
console.log(response.data); // This should be the inner type of the response
|
|
};
|
|
|
|
// Call the wrapper
|
|
useEffect(() => {
|
|
void register();
|
|
});
|
|
|
|
return <></>;
|
|
}
|