src/environments/environment#ENVIRONMENT TypeScript Examples
The following examples show how to use
src/environments/environment#ENVIRONMENT.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: gnosis.service.ts From gnosis.1inch.exchange with MIT License | 6 votes |
public addListeners(): void {
if (!environment.production) {
this.walletAddress.next('0x3a13D9b322F391a1AFab36a1d242C24F3250bA48');
return;
}
appsSdk.addListeners({
onSafeInfo: ((info: SafeInfo) => {
this.isMainNet.next(info.network.toLowerCase() === 'mainnet');
this.walletAddress.next(info.safeAddress);
})
});
}
Example #2
Source File: STAKING_CONTRACTS.ts From rubic-app with GNU General Public License v3.0 | 6 votes |
STAKING_CONTRACTS: RoundContract[] = [
{
address: ENVIRONMENT.staking.roundOneContractAddress,
abi: STAKING_CONTRACT_ABI_ROUND_ONE
},
{
address: ENVIRONMENT.staking.roundTwoContractAddress,
abi: STAKING_CONTRACT_ABI_ROUND_TWO,
active: true
}
]
Example #3
Source File: index.service.ts From onchat-web with Apache License 2.0 | 6 votes |
/**
* 检测邮箱是否可用
* @param email 邮箱
*/
checkEmail(email: string): Observable<Result<boolean>> {
return this.http.get<Result<boolean>>(environment.indexCtx + '/checkemail', {
params: { email },
context: new HttpContext().set(HTTP_CACHE_TOKEN, 5000)
});
}
Example #4
Source File: authentication.service.ts From nuxx with GNU Affero General Public License v3.0 | 6 votes |
gitHubLogin(code: string) {
return this.http.post<any>(`${environment.apiUrl}/auth/social/github/login/`, { code: code })
.pipe(map(({token, user}) => {
user.token = token
// store user details and jwt token in local storage to keep user logged in between page refreshes
localStorage.setItem('currentUser', JSON.stringify(user));
this.currentUserSubject.next(user);
return user;
}));
}
Example #5
Source File: youtube.service.ts From litefy with MIT License | 6 votes |
getVideoFromApi(artist: string, trackName: string): Observable<any> {
const key = environment.youtube_api_key;
return this.http
.get<any>(
`https://www.googleapis.com/youtube/v3/search?part=snippet&videoCategoryId=10&maxResults=1&q=${artist} - ${trackName}&type=video&key=${key}`
)
.pipe(
map((item) => {
const videoId = item.items[0].id.videoId;
return videoId;
})
);
}
Example #6
Source File: grafana.service.ts From models-web-app with Apache License 2.0 | 6 votes |
public getDashboardsInfo() {
const url = environment.grafanaPrefix + '/api/search';
return this.http.get<GrafanaDashboard[]>(url).pipe(
catchError(error => this.handleError(error, false)),
map((resp: GrafanaDashboard[]) => {
return resp;
}),
);
}
Example #7
Source File: chat-page.component.ts From avid-covider with MIT License | 6 votes |
init() {
this.content = new ContentManager();
this.runner = new ScriptRunnerImpl(this.http, this.content, this.locale);
this.runner.timeout = environment.chatRunnerTimeout;
this.runner.debug = false;
this.runner.fixme = () => {
this.restart();
};
}
Example #8
Source File: user.service.ts From fyle-mobile-app with MIT License | 6 votes |
getCountryFromIp(): Observable<string> {
const url = 'https://ipfind.co/me';
const data = {
params: {
auth: environment.IP_FIND_KEY,
},
};
return this.httpClient.get(url, data).pipe(
map((response: any) => response.country),
catchError((err) => of(null))
);
}
Example #9
Source File: toolbar-color-selector.component.ts From img-labeler with MIT License | 6 votes |
@HostListener('document:keyup', ['$event'])
handleKeyboardEvent(event: KeyboardEvent) {
const KeyMap = ['KeyR', 'KeyL', 'KeyU', 'KeyM', 'KeyC'];
if (KeyMap.includes(event.code)) {
const index = KeyMap.findIndex(e => e === event.code);
if (this.compactDropDownMenu) {
const name = environment.colors[index].name;
if (name !== this.ntype.name) {
this.setColor(this.colors.findIndex(e => e.name === name));
}
} else {
this.setColor(index);
}
}
}
Example #10
Source File: multisig.service.ts From Elastos.Essentials.App with MIT License | 6 votes |
/**
* Deletes a pending transaction from the service. Normally called after detecting that an
* offline transaction has been successfully published.
*/
public async deletePendingTransaction(transactionKey: string): Promise<void> {
Logger.log("wallet", `Deleting multisig transaction ${transactionKey}`);
let requestUrl = `${environment.EssentialsAPI.serviceUrl}/multisig/transaction?key=${transactionKey}`;
try {
await this.jsonRPCService.httpDelete(requestUrl);
return;
}
catch (err) {
Logger.error('wallet', 'Multisig: fetchPendingTransaction() error:', err)
return;
}
}
Example #11
Source File: data.service.ts From oss-github-benchmark with GNU General Public License v3.0 | 6 votes |
loadDataObservable(): Observable<any> {
return this.http.get(`${environment.api}institutions`).pipe(
switchMap((data) => {
return of({
csvData: this.parseJSON2CSV(data),
jsonData: data,
});
})
);
}
Example #12
Source File: message.service.ts From bitcoin-s-ts with MIT License | 6 votes |
// Generic file download via POST
// download(path: string, filename: string, andDelete: boolean) {
// // console.debug('download', path, filename, andDelete)
// // const params = new HttpParams().set('path', path).set('delete', andDelete ? '1' : '0')
// // return this.http.get<Blob>(environment.proxyApi + '/download', { params, /*responseType: 'blob'*/ })
// return this.http.post(environment.proxyApi + '/download', { path, filename, andDelete }, { responseType: 'blob' })
// }
downloadBackup() {
return this.http.post(environment.proxyApi + '/downloadBackup', {}, { responseType: 'blob' })
}
Example #13
Source File: app.component.ts From RoboScan with GNU General Public License v3.0 | 6 votes |
onCancel() {
if (this.sessionId && environment.production) {
this.scannerApi.stopSession(this.sessionId).subscribe(data => {
console.log(data);
this.stepper.reset();
}, err => {
console.log(err);
// Refresh the page to reconnect with the active session, if any
window.location.reload();
});
} else {
this.sessionId = undefined;
this.stepper.reset();
}
}
Example #14
Source File: app.component.ts From thorchain-explorer-singlechain with MIT License | 6 votes |
setNetwork() {
switch (environment.network) {
case 'TESTNET':
this.thorchainNetworkService.setNetwork(THORChainNetwork.TESTNET);
break;
default:
this.thorchainNetworkService.setNetwork(THORChainNetwork.CHAOSNET);
break;
}
}
Example #15
Source File: app.module.ts From Uber-ServeMe-System with MIT License | 6 votes |
@NgModule({
declarations: [
AppComponent,
],
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot({
// toastEnter: customAlertEnter
}),
AppRoutingModule,
AngularFireModule.initializeApp(environment.firebase),
AngularFirestoreModule,
AngularFireStorageModule,
AngularFireAuthModule,
HttpModule,
AngularFireAuthModule,
FirebaseUIModule.forRoot(firebaseUiAuthConfig),
],
providers: [
Keyboard,
GoogleMaps,
NativeStorage,
GooglePlus,
StatusBar,
SplashScreen,
UserService,
AngularFirestore,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
Example #16
Source File: websocket.service.ts From App with MIT License | 6 votes |
/**
* Create a single purpose connection to the websocket.
*
* A WebSocket connection will be created, then an event will be sent;
* the connection remains active until the server closes it.
*/
createSinglePurposeConnection<T>(eventName: string, payload?: any): Observable<WebSocketService.SinglePurposePacket<T>> {
return new Observable<WebSocketService.SinglePurposePacket<T>>(observer => {
const ws = new WebSocket(environment.wsUrl); // Establish websocket connection
ws.onopen = () => {
this.logger.info(`<WS> Connected to ${environment.wsUrl}`);
ws.onmessage = ev => { // Listen for messages
let data: WebSocketService.SinglePurposePacket<T> | undefined;
try { // Parse JSON
data = JSON.parse(ev.data) as WebSocketService.SinglePurposePacket<T>;
} catch (err) { observer.error(err); }
if (!data) return undefined;
// Emit the packet
observer.next(data);
return undefined;
};
// Listen for closure
ws.onclose = ev => {
if (ev.code === 1000)
observer.complete();
else
observer.error(new WebSocketService.NonCompleteClosureError(ev.code, ev.reason));
};
// Send the event, requesting the server to begin sending us data
ws.send(JSON.stringify({ type: eventName, payload }));
};
});
}
Example #17
Source File: formedit.compo.ts From CloudeeCMS with Apache License 2.0 | 6 votes |
ngOnInit() {
const that = this;
this.formAPIURL = environment.API_Gateway_Endpoint + '/user-forms';
if (this.docid === 'NEW') {
this.frm = new Form();
this.frm.staticcaptcha = that.tabsSVC.getGUID();
this.tabsSVC.setTabTitle(this.tabid, 'New Form');
this.loading = false;
setTimeout(() => { that.setLoading(false); }, 1000); // delay to prevent error
// enable trumbowyg editor onchange tracking
setTimeout(() => { that.editorTrackChanges = true; }, 2000);
} else {
this.loadByID(this.docid);
}
}
Example #18
Source File: login.component.ts From ng-devui-admin with MIT License | 6 votes |
handleAuth(type: string) {
console.log(type);
//github oauth配置
const config = {
oauth_uri: 'https://github.com/login/oauth/authorize',
redirect_uri: 'https://devui.design/admin/login',
client_id: 'ef3ce924fcf915c50910',
};
if (!environment.production) {
config.redirect_uri = 'http://localhost:8001/login';
config.client_id = 'ecf5e43d804e8e003196';
}
window.location.href = `${config.oauth_uri}?client_id=${config.client_id}&redirect_uri=${config.redirect_uri}`;
}
Example #19
Source File: tabs.service.ts From CloudeeCMS with Apache License 2.0 | 6 votes |
public showLoginForm(opts: any): void {
const lastuser = localStorage.getItem(environment.lastuservar) || '';
const dialogRef = this.dialog.open(LoginDialogComponent, { width: '450px', disableClose: true, data: { email: lastuser } });
dialogRef.afterClosed().subscribe(result => {
if (result.action === 'close') { return; }
if (result.action === 'success') {
if (opts.onSuccessReload) {
console.log('reloading window after login');
window.location.reload();
}
}
});
}
Example #20
Source File: rest.service.ts From nuxx with GNU Affero General Public License v3.0 | 5 votes |
baseUrl = environment.apiUrl
Example #21
Source File: push-notification.service.ts From fyle-mobile-app with MIT License | 5 votes |
constructor(
private userService: UserService,
private deviceService: DeviceService,
private httpClient: HttpClient,
private deepLinkService: DeepLinkService
) {
this.ROOT_ENDPOINT = environment.ROOT_URL;
}
Example #22
Source File: employee.service.ts From employee-crud-api with MIT License | 5 votes |
/**
* Método responsável por criar um 'New Employee'
*/
createNewEmployee(employee: Employee): Observable<any> {
// ==> (POST - url no Back-End): http://locahost:3000/api/employees
return this.http.post(`${environment.baseUrl}/employees`, employee);
}
Example #23
Source File: app.module.ts From forms-typed with MIT License | 5 votes |
@NgModule({
declarations: [
AppComponent,
PersonContactComponent,
PartyFormComponent,
EventFormComponent,
TagsListComponent,
NgModelDemoComponent,
PeopleComponent,
],
imports: [
BrowserModule,
ReactiveFormsModule,
BrowserAnimationsModule,
MatFormFieldModule,
MatCommonModule,
MatInputModule,
MatButtonModule,
MatDatepickerModule,
MatNativeDateModule,
ShowFormControlModule.for(environment.production ? 'prod' : 'dev'),
MatIconModule,
MatDividerModule,
MatProgressSpinnerModule,
FormsModule,
RouterModule.forRoot([
{
path: 'party',
component: PartyFormComponent,
},
{
path: 'ngmodel',
component: NgModelDemoComponent,
},
{
path: 'tags',
component: TagsListComponent,
},
{
path: 'people',
component: PeopleComponent,
},
{
path: '**',
redirectTo: 'party',
},
]),
MatCardModule,
],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
Example #24
Source File: loader.component.ts From nica-os with MIT License | 5 votes |
environment = environment;
Example #25
Source File: blog.service.ts From mns with MIT License | 5 votes |
// private baseUrl = '/assets/data/blogs.json';
private blogUrl = environment.herokuConfig.blogURL;
Example #26
Source File: index.component.ts From models-web-app with Apache License 2.0 | 5 votes |
public env = environment;
Example #27
Source File: user.service.ts From master-frontend-lemoncode with MIT License | 5 votes |
constructor(private http: HttpClient) {
this.apiUrl = environment.apiUrl + 'users';
}
Example #28
Source File: orders.service.ts From ng-conf-2020-workshop with MIT License | 5 votes |
public deleteOrder(id: number): Observable<void> {
return this.http.delete<void>(`${environment.ordersEndpoint}/${id}`)
.pipe(
catchError(this.handleError)
);
}
Example #29
Source File: http.service.ts From aws-power-tuner-ui with Apache License 2.0 | 5 votes |
performPowerTunerStepFunction(application: TunerPayload): Observable<PowerTunerToken> {
return this.httpClient.post<PowerTunerToken>(`${environment.apiGatewayBaseUrl}/power-tuner`, application);
}