Skip to content

Commit

Permalink
feat(core): 新增api前缀service
Browse files Browse the repository at this point in the history
  • Loading branch information
stbui committed Jul 9, 2018
1 parent c1cf88a commit 382a072
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/app/core/api-prefix.interceptor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @license
* Copyright Stbui All Rights Reserved.
* https://github.com/stbui
*/

import { Injectable } from '@angular/core';
import {
HttpEvent,
HttpInterceptor,
HttpHandler,
HttpRequest
} from '@angular/common/http';
import { Observable } from 'rxjs';

import { environment } from '../../environments/environment';

@Injectable()
export class ApiPrefixInterceptor implements HttpInterceptor {
intercept(
request: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
request = request.clone({ url: environment.serverUrl + request.url });
return next.handle(request);
}
}
1 change: 1 addition & 0 deletions src/environments/environment.github.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const environment = {
production: false,
serverUrl:'/',
firebase: {
apiKey: 'AIzaSyAGcYsQtc9xqqEKstnoO3WasuZxJmKTwNc',
authDomain: 'angular-material-app-stbui.firebaseapp.com',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.ngsw.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const environment = {
production: false,
ngsw: true,
serverUrl:'/',
firebase: {
apiKey: 'AIzaSyAGcYsQtc9xqqEKstnoO3WasuZxJmKTwNc',
authDomain: 'angular-material-app-stbui.firebaseapp.com',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const environment = {
production: true,
serverUrl:'/',
firebase: {
apiKey: 'AIzaSyAGcYsQtc9xqqEKstnoO3WasuZxJmKTwNc',
authDomain: 'angular-material-app-stbui.firebaseapp.com',
Expand Down
1 change: 1 addition & 0 deletions src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export const environment = {
production: false,
serverUrl:'/',
firebase: {
apiKey: 'AIzaSyAGcYsQtc9xqqEKstnoO3WasuZxJmKTwNc',
authDomain: 'angular-material-app-stbui.firebaseapp.com',
Expand Down

0 comments on commit 382a072

Please sign in to comment.