Skip to content

Commit 46e57d7

Browse files
committed
make all api operations use relative paths
1 parent 77c0886 commit 46e57d7

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

client/src/state/redux/auth/operations.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import actions from '../charts/actions';
1818
import Auth from '../../Auth';
1919

2020
const login = ({ user, password }, networkObj) => dispatch =>
21-
post('/auth/login', { user, password, network: networkObj })
21+
post('auth/login', { user, password, network: networkObj })
2222
.then(resp => {
2323
Auth.authenticateUser(resp.token);
2424
dispatch(errorAction(null));
@@ -33,7 +33,7 @@ const login = ({ user, password }, networkObj) => dispatch =>
3333
});
3434

3535
const network = () => dispatch =>
36-
get('/auth/networklist', {})
36+
get('auth/networklist', {})
3737
.then(({ networkList }) => {
3838
dispatch(networkAction({ networks: networkList }));
3939
})
@@ -44,7 +44,7 @@ const network = () => dispatch =>
4444
});
4545

4646
const register = user => dispatch =>
47-
post('/api/register', { ...user })
47+
post('api/register', { ...user })
4848
.then(resp => {
4949
if (resp.status === 500) {
5050
dispatch(
@@ -67,7 +67,7 @@ const register = user => dispatch =>
6767
});
6868

6969
const userlist = () => dispatch =>
70-
get('/api/userlist')
70+
get('api/userlist')
7171
.then(resp => {
7272
if (resp.status === 500) {
7373
dispatch(
@@ -90,7 +90,7 @@ const userlist = () => dispatch =>
9090
});
9191

9292
const unregister = user => dispatch =>
93-
post('/api/unregister', { ...user })
93+
post('api/unregister', { ...user })
9494
.then(resp => {
9595
if (resp.status === 500) {
9696
dispatch(
@@ -113,7 +113,7 @@ const unregister = user => dispatch =>
113113
});
114114

115115
const logout = () => dispatch =>
116-
post('/auth/logout', {})
116+
post('auth/logout', {})
117117
.then(resp => {
118118
console.log(resp);
119119
Auth.deauthenticateUser();

client/src/state/redux/charts/operations.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { get } from '../../../services/request';
77

88
/* istanbul ignore next */
99
const blockPerHour = channelName => dispatch =>
10-
get(`/api/blocksByHour/${channelName}/1`)
10+
get(`api/blocksByHour/${channelName}/1`)
1111
.then(resp => {
1212
if (resp.status === 500) {
1313
dispatch(
@@ -27,7 +27,7 @@ const blockPerHour = channelName => dispatch =>
2727

2828
/* istanbul ignore next */
2929
const blockPerMin = channelName => dispatch =>
30-
get(`/api/blocksByMinute/${channelName}/1`)
30+
get(`api/blocksByMinute/${channelName}/1`)
3131
.then(resp => {
3232
if (resp.status === 500) {
3333
dispatch(
@@ -47,7 +47,7 @@ const blockPerMin = channelName => dispatch =>
4747

4848
/* istanbul ignore next */
4949
const changeChannel = channelName => dispatch =>
50-
get(`/api/changeChannel/${channelName}`)
50+
get(`api/changeChannel/${channelName}`)
5151
.then(resp => {
5252
if (resp.status === 500) {
5353
dispatch(
@@ -67,7 +67,7 @@ const changeChannel = channelName => dispatch =>
6767

6868
/* istanbul ignore next */
6969
const channel = () => dispatch =>
70-
get('/api/curChannel')
70+
get('api/curChannel')
7171
.then(resp => {
7272
if (resp.status === 500) {
7373
dispatch(
@@ -87,7 +87,7 @@ const channel = () => dispatch =>
8787

8888
/* istanbul ignore next */
8989
const channelList = () => dispatch =>
90-
get('/api/channels')
90+
get('api/channels')
9191
.then(resp => {
9292
if (resp.status === 500) {
9393
dispatch(
@@ -107,7 +107,7 @@ const channelList = () => dispatch =>
107107

108108
/* istanbul ignore next */
109109
const dashStats = channelName => dispatch =>
110-
get(`/api/status/${channelName}`)
110+
get(`api/status/${channelName}`)
111111
.then(resp => {
112112
if (resp.status === 500) {
113113
dispatch(
@@ -127,7 +127,7 @@ const dashStats = channelName => dispatch =>
127127

128128
/* istanbul ignore next */
129129
const blockActivity = channelName => dispatch =>
130-
get(`/api/blockActivity/${channelName}`)
130+
get(`api/blockActivity/${channelName}`)
131131
.then(resp => {
132132
if (resp.status === 500) {
133133
dispatch(
@@ -154,7 +154,7 @@ const notification = notificationObj => dispatch => {
154154

155155
/* istanbul ignore next */
156156
const transactionByOrg = channelName => dispatch =>
157-
get(`/api/txByOrg/${channelName}`)
157+
get(`api/txByOrg/${channelName}`)
158158
.then(resp => {
159159
if (resp.status === 500) {
160160
dispatch(
@@ -174,7 +174,7 @@ const transactionByOrg = channelName => dispatch =>
174174

175175
/* istanbul ignore next */
176176
const transactionPerHour = channelName => dispatch =>
177-
get(`/api/txByHour/${channelName}/1`)
177+
get(`api/txByHour/${channelName}/1`)
178178
.then(resp => {
179179
if (resp.status === 500) {
180180
dispatch(
@@ -194,7 +194,7 @@ const transactionPerHour = channelName => dispatch =>
194194

195195
/* istanbul ignore next */
196196
const transactionPerMin = channelName => dispatch =>
197-
get(`/api/txByMinute/${channelName}/1`)
197+
get(`api/txByMinute/${channelName}/1`)
198198
.then(resp => {
199199
if (resp.status === 500) {
200200
dispatch(

client/src/state/redux/tables/operations.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { get } from '../../../services/request';
77
/* istanbul ignore next */
88
const blockListSearch = (channel, query, pageParams) => dispatch =>
99
get(
10-
`/api/blockAndTxList/${channel}/0?${query ? query : ''
10+
`api/blockAndTxList/${channel}/0?${query ? query : ''
1111
}&page=${pageParams?.page || 1}&size=${pageParams?.size || 10}`
1212
)
1313
.then(resp => {
@@ -30,7 +30,7 @@ const blockListSearch = (channel, query, pageParams) => dispatch =>
3030

3131
/* istanbul ignore next */
3232
const chaincodeList = channel => dispatch =>
33-
get(`/api/chaincode/${channel}`)
33+
get(`api/chaincode/${channel}`)
3434
.then(resp => {
3535
if (resp.status === 500) {
3636
dispatch(
@@ -52,7 +52,7 @@ const chaincodeList = channel => dispatch =>
5252

5353
/* istanbul ignore next */
5454
const channels = () => dispatch =>
55-
get('/api/channels/info')
55+
get('api/channels/info')
5656
.then(resp => {
5757
if (resp.status === 500) {
5858
dispatch(
@@ -72,7 +72,7 @@ const channels = () => dispatch =>
7272

7373
/* istanbul ignore next */
7474
const peerList = channel => dispatch =>
75-
get(`/api/peersStatus/${channel}`)
75+
get(`api/peersStatus/${channel}`)
7676
.then(resp => {
7777
if (resp.status === 500) {
7878
dispatch(
@@ -91,7 +91,7 @@ const peerList = channel => dispatch =>
9191
});
9292

9393
const txnList = (channel, query) => dispatch =>
94-
get(`/api/fetchDataByTxnId/${channel}/${query}`)
94+
get(`api/fetchDataByTxnId/${channel}/${query}`)
9595
.then(resp => {
9696
if (resp.status === 500) {
9797
dispatch(
@@ -111,7 +111,7 @@ const txnList = (channel, query) => dispatch =>
111111
});
112112

113113
const blockSearch = (channel, query) => dispatch =>
114-
get(`/api/fetchDataByBlockNo/${channel}/${query}`)
114+
get(`api/fetchDataByBlockNo/${channel}/${query}`)
115115
.then(resp => {
116116
if (resp.status === 500) {
117117
dispatch(
@@ -132,7 +132,7 @@ const blockSearch = (channel, query) => dispatch =>
132132

133133
/* istanbul ignore next */
134134
const transaction = (channel, transactionId) => dispatch =>
135-
get(`/api/transaction/${channel}/${transactionId}`)
135+
get(`api/transaction/${channel}/${transactionId}`)
136136
.then(resp => {
137137
if (resp.status === 500) {
138138
dispatch(
@@ -151,7 +151,7 @@ const transaction = (channel, transactionId) => dispatch =>
151151
});
152152

153153
const transactionListSearch = (channel, query, pageParams) => dispatch =>
154-
get(`/api/txList/${channel}/0/0?${query?query:''}&page=${pageParams?.page||1}&size=${pageParams?.size||10}`)
154+
get(`api/txList/${channel}/0/0?${query?query:''}&page=${pageParams?.page||1}&size=${pageParams?.size||10}`)
155155
.then(resp => {
156156
let params={page:pageParams?.page||1,size:pageParams?.size ||10}
157157
dispatch(actions.getTransactionListSearch({...resp,query,pageParams:params}));
@@ -162,7 +162,7 @@ const transactionListSearch = (channel, query, pageParams) => dispatch =>
162162
const blockRangeSearch = (channel, query1, query2) => dispatch =>
163163
{
164164
dispatch(actions.getLoaded(false));
165-
get(`/api/fetchDataByBlockRange/${channel}/${query1}/${query2}`)
165+
get(`api/fetchDataByBlockRange/${channel}/${query1}/${query2}`)
166166
.then(resp => {
167167
console.log('response-got', resp);
168168
if (resp.status === 500) {
@@ -183,7 +183,7 @@ const blockRangeSearch = (channel, query1, query2) => dispatch =>
183183
}
184184
/* istanbul ignore next */
185185
const transactionList = (channel,params) => dispatch =>
186-
get(`/api/txList/${channel}/0/0/?page=${params.page}&size=${params.size}`)
186+
get(`api/txList/${channel}/0/0/?page=${params.page}&size=${params.size}`)
187187
.then(resp => {
188188
if (resp.status === 500) {
189189
dispatch(
@@ -202,7 +202,7 @@ const transactionList = (channel,params) => dispatch =>
202202
});
203203

204204
const chaincodeMetaData = (channel,query) => dispatch =>
205-
get(`/api/metadata/${channel}/${query}`)
205+
get(`api/metadata/${channel}/${query}`)
206206
.then(resp => {
207207
if (resp.status === 500) {
208208
dispatch(
@@ -219,13 +219,13 @@ const chaincodeMetaData = (channel,query) => dispatch =>
219219
.catch(error => {
220220
console.error(error);
221221
});
222-
222+
223223
export default {
224224
chaincodeList,
225225
channels,
226226
peerList,
227-
txnList,
228-
blockSearch,
227+
txnList,
228+
blockSearch,
229229
chaincodeMetaData,
230230
transaction,
231231
transactionList,

0 commit comments

Comments
 (0)