Skip to content

Commit ba3887b

Browse files
authored
Merge pull request codeBelt#17 from codeBelt/js/fix-api-add-baseroute
fix api to https and add base route
2 parents 5be22a1 + ef22ef4 commit ba3887b

File tree

6 files changed

+15
-4
lines changed

6 files changed

+15
-4
lines changed

src/environments/base.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55

66
export default function(baseApi) {
77
return {
8+
route: {
9+
baseRoute: '',
10+
},
811
api: {
912
shows: `${baseApi}/shows/:showId`,
1013
episodes: `${baseApi}/shows/:showId/episodes`,

src/environments/development.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import environment from './base';
22

3-
const baseApi = 'http://api.tvmaze.com';
3+
const baseApi = 'https://api.tvmaze.com';
44
const env = environment(baseApi);
55

66
export default {

src/environments/production.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import environment from './base';
55
* You shouldn't have override anything.
66
*/
77

8-
const baseApi = 'http://api.tvmaze.com';
8+
const baseApi = 'https://api.tvmaze.com';
99
const env = environment(baseApi);
1010

1111
export default {
1212
...env,
13+
route: {
14+
...env.route,
15+
baseRoute: '/react-redux-architecture', // Fixes issue with Github Pages
16+
},
1317
};

src/environments/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import environment from './base';
22

3-
const baseApi = 'http://api.tvmaze.com';
3+
const baseApi = 'https://api.tvmaze.com';
44
const env = environment(baseApi);
55

66
export default {

src/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ import { Provider } from 'react-redux';
66
import { createBrowserHistory } from 'history';
77
import rootStore from './stores/rootStore';
88
import App from './views/App';
9+
import environment from 'environment';
910

1011
(async (window) => {
1112
const initialState = {};
12-
const history = createBrowserHistory();
13+
const history = createBrowserHistory({ basename: environment.route.baseRoute });
1314
const store = rootStore(initialState, history);
1415

1516
const rootEl = document.getElementById('root');

src/typings.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ declare module 'lodash.groupby';
33

44
declare module 'environment' {
55
const value: {
6+
route: {
7+
baseRoute: string;
8+
};
69
api: {
710
shows: string;
811
episodes: string;

0 commit comments

Comments
 (0)