mirror of
https://github.com/sartography/app-template-angular-material.git
synced 2025-02-23 04:38:09 +00:00
Replaces unnecessary regex with plain old string search
This commit is contained in:
parent
eb52cb183b
commit
5dd40c1c83
@ -111,7 +111,12 @@ export class ApiService {
|
||||
}
|
||||
|
||||
private _dummy_api_url(path: string) {
|
||||
return path.replace(/^(.*)\/api\/(.*)$/, '/assets/json/$2.json');
|
||||
if (path.search('/api/') !== -1) {
|
||||
const arr = path.split('/api/');
|
||||
if (arr.length > 0) {
|
||||
return `/assets/json/${arr[arr.length - 1]}.json`;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private _getOne<T extends GenericType>(id: number, endpointName: string): Observable<T> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user