59 lines
1.3 KiB
TypeScript
59 lines
1.3 KiB
TypeScript
import { Injectable } from '@angular/core';
|
|
import { environment } from '../../../environments/environment';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class ApiConfigService {
|
|
private readonly baseUrl = environment.apiUrl;
|
|
|
|
constructor() { }
|
|
|
|
/**
|
|
* Get the full API URL for a specific endpoint
|
|
* @param endpoint - The API endpoint (e.g., 'Auth', 'Users', 'Transactions')
|
|
* @returns Full API URL
|
|
*/
|
|
getApiUrl(endpoint: string): string {
|
|
return `${this.baseUrl}/${endpoint}`;
|
|
}
|
|
|
|
/**
|
|
* Get the base API URL
|
|
* @returns Base API URL
|
|
*/
|
|
getBaseUrl(): string {
|
|
return this.baseUrl;
|
|
}
|
|
|
|
/**
|
|
* Get specific API endpoints
|
|
*/
|
|
get authUrl(): string {
|
|
return this.getApiUrl('Auth');
|
|
}
|
|
|
|
get tokenUrl(): string {
|
|
return this.getApiUrl('Token');
|
|
}
|
|
|
|
get usersUrl(): string {
|
|
return this.getApiUrl('Users');
|
|
}
|
|
|
|
get transactionsUrl(): string {
|
|
return this.getApiUrl('Transactions');
|
|
}
|
|
|
|
get dashboardUrl(): string {
|
|
return this.getApiUrl('Dashboard');
|
|
}
|
|
get ordersUrl(): string {
|
|
return this.getApiUrl('ClientBridgeOrder');
|
|
}
|
|
|
|
get orderDetailUrl(): string {
|
|
return this.getApiUrl('OrderDetail');
|
|
}
|
|
}
|