Build a login API call
When it comes to mounting our core login function to the server, we are going to use basic authentication to send our credentials. This means that our API call function is going to be separate from the others as there are some extra steps. Seeing that our login API call is the only function that will utilise these steps, we might as well keep the login API call function separate and isolated.
We still want to utilise the functionality of the Url
class so we will add the login endpoint to the Url
class resulting in the following outline of the Url
class:
// ingress/frontend/src/api/url.ts
export class Url {
baseUrl: string;
create: string;
getAll: string;
update: string;
login: string;
constructor() {
this.baseUrl = Url.getBaseUrl();
this.create = `${this.baseUrl}api/v1/create`;
this.getAll = `${this.baseUrl}api/v1/get/all`;
this.update = `${this.baseUrl}api/v1/update`;
this.login = `${this.baseUrl...