ng build --prod
import { environment } from 'src/environments/environment';
export class AppComponent implements OnInit {
url = environment.apiUrl;
}
import { Observable } from 'rxjs/Rx';
export abstract class BaseService {
protected readonly api = process.env.VUE_APP_API_ENDPOINT;
protected handleError(error: any) {
const applicationError = error.headers['Application-Error'];
if (applicationError) {
return Observable.throw(applicationError);
}
let modelStateErrors: any = '';
if (error.data) {
for (const key in error.data) {
if (error.data[key]) {
modelStateErrors += error.data[key] + '\n';
}
}
}
modelStateErrors = modelStateErrors = '' ? null : modelStateErrors;
return Observable.throw(modelStateErrors || 'Server error');
}
}
VUE_APP_API_ENDPOINT = 'http://localhost:5000/api'
VUE_APP_API_ENDPOINT ='/api'