db switcher updates

This commit is contained in:
Cyril Joseph 2025-09-17 21:52:00 -03:00
parent 8c60d91be7
commit d6d1a2d508
3 changed files with 9 additions and 8 deletions

View File

@ -14,6 +14,7 @@ import { ApiErrorHandlerService } from './api-error-handler.service';
export class AuthService {
private apiUrl = environment.apiUrl;
private applicationName = environment.appType;
private apiDb = environment.apiDb;
private http = inject(HttpClient);
private userService = inject(UserService);
@ -23,16 +24,16 @@ export class AuthService {
private errorHandler = inject(ApiErrorHandlerService);
login(username: string, password: string): Observable<any> {
return this.http.post(`${this.apiUrl}/login`, { p_emailaddr: username, p_password: password, P_APPLICATIONNAME: this.applicationName });
return this.http.post(`${this.apiUrl}/${this.apiDb}/login`, { p_emailaddr: username, p_password: password, P_APPLICATIONNAME: this.applicationName });
}
refreshToken(): Observable<any> {
return this.http.get(`${this.apiUrl}/refresh-tokens`, {});
return this.http.get(`${this.apiUrl}/${this.apiDb}/refresh-tokens`, {});
}
logout(): void {
if (this.userService.isLoggedIn()) {
this.http.post(`${this.apiUrl}/logout`, {}).subscribe({
this.http.post(`${this.apiUrl}/${this.apiDb}/logout`, {}).subscribe({
next: (response) => {
this.userService.clearUser();
this.storageService.clear();
@ -50,7 +51,7 @@ export class AuthService {
register(email: string, password: string): Observable<any> {
return this.http.post(
`${this.apiUrl}/register`,
`${this.apiUrl}/${this.apiDb}/register`,
{ P_EMAILADDR: email, P_PASSWORD: password }
);
}
@ -63,7 +64,7 @@ export class AuthService {
}
return this.http.put(
`${this.apiUrl}/forgot-password`,
`${this.apiUrl}/${this.apiDb}/forgot-password`,
{ P_EMAILADDR: email, P_PASSWORD: password },
{ headers }
);
@ -71,7 +72,7 @@ export class AuthService {
sendEmail(email: string, type: string): Observable<any> {
return this.http.post(
`${this.apiUrl}/sendmail`,
`${this.apiUrl}/${this.apiDb}/sendmail`,
{ P_TO: email, P_MAIL_TYPE: type }
);
}

View File

@ -1,6 +1,6 @@
export const environment = {
production: false,
apiUrl: 'https://dev.alphaomegainfosys.com/test-api',
apiDb: 'oracle',
apiDb: '1',
appType: 'policy'
};

View File

@ -1,6 +1,6 @@
export const environment = {
production: true,
apiUrl: 'https://dev.alphaomegainfosys.com/test-api',
apiDb: 'oracle',
apiDb: '1',
appType: 'policy'
};