mirror of
https://github.com/dadosfera/maestro.git
synced 2026-11-08 21:39:08 +00:00
REFACTOR: Project Pattern and AuthClient (DUC)
This commit is contained in:
+15
-24
@@ -1,29 +1,20 @@
|
||||
import axios from "axios";
|
||||
import axios from 'axios';
|
||||
|
||||
export class AuthenticateController {
|
||||
private username: string;
|
||||
private password: string;
|
||||
|
||||
export class AuthenticateController{
|
||||
|
||||
private username:string;
|
||||
private password:string;
|
||||
|
||||
constructor(){
|
||||
this.username = process.env.AUTH_USERNAME
|
||||
this.password = process.env.AUTH_PASSWORD
|
||||
}
|
||||
|
||||
|
||||
|
||||
async authenticate():Promise<string>{
|
||||
|
||||
const response = await axios.post(process.env.AUTH_ROUTE,
|
||||
{
|
||||
username:this.username,
|
||||
password:this.password
|
||||
}
|
||||
)
|
||||
|
||||
return response.data.accessToken
|
||||
}
|
||||
constructor() {
|
||||
this.username = process.env.AUTH_USERNAME;
|
||||
this.password = process.env.AUTH_PASSWORD;
|
||||
}
|
||||
|
||||
async authenticate(): Promise<string> {
|
||||
const response = await axios.post(process.env.AUTH_ROUTE, {
|
||||
username: this.username,
|
||||
password: this.password,
|
||||
});
|
||||
|
||||
return response.data.accessToken;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user