Skip to content
Snippets Groups Projects
Commit bf1c3278 authored by Henrik's avatar Henrik
Browse files

feat: Add authentication service

parent c72cda41
No related branches found
No related tags found
No related merge requests found
Pipeline #274137 failed
......@@ -21,7 +21,7 @@ export type OpenAPIConfig = {
export const OpenAPI: OpenAPIConfig = {
BASE: 'http://localhost:8080',
VERSION: '0',
VERSION: '3.0',
WITH_CREDENTIALS: false,
CREDENTIALS: 'include',
TOKEN: undefined,
......
......@@ -6,3 +6,10 @@ export { ApiError } from './core/ApiError';
export { CancelablePromise, CancelError } from './core/CancelablePromise';
export { OpenAPI } from './core/OpenAPI';
export type { OpenAPIConfig } from './core/OpenAPI';
export type { AuthenticationResponse } from './models/AuthenticationResponse';
export type { ExceptionResponse } from './models/ExceptionResponse';
export type { LoginRequest } from './models/LoginRequest';
export type { SignUpRequest } from './models/SignUpRequest';
export { AuthenticationService } from './services/AuthenticationService';
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type AuthenticationResponse = {
token?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type ExceptionResponse = {
status?: number;
message?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type LoginRequest = {
email?: string;
password?: string;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export type SignUpRequest = {
firstName?: string;
lastName?: string;
email?: string;
password?: string;
changeWilling?: string;
experience?: string;
challenges?: Array<string>;
};
/* generated using openapi-typescript-codegen -- do not edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
import type { AuthenticationResponse } from '../models/AuthenticationResponse';
import type { LoginRequest } from '../models/LoginRequest';
import type { SignUpRequest } from '../models/SignUpRequest';
import type { CancelablePromise } from '../core/CancelablePromise';
import { OpenAPI } from '../core/OpenAPI';
import { request as __request } from '../core/request';
export class AuthenticationService {
/**
* User Signup
* Sign up a new user
* @returns AuthenticationResponse Successfully signed up
* @throws ApiError
*/
public static signup({
requestBody,
}: {
requestBody: SignUpRequest,
}): CancelablePromise<AuthenticationResponse> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/auth/signup',
body: requestBody,
mediaType: 'application/json',
errors: {
409: `Email already exists`,
},
});
}
/**
* User Login
* Log in with an existing user
* @returns AuthenticationResponse Successfully logged in
* @throws ApiError
*/
public static login({
requestBody,
}: {
requestBody: LoginRequest,
}): CancelablePromise<AuthenticationResponse> {
return __request(OpenAPI, {
method: 'POST',
url: '/api/auth/login',
body: requestBody,
mediaType: 'application/json',
errors: {
401: `Invalid credentials`,
404: `User not found`,
},
});
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment