@@ -25,9 +25,9 @@ export const loadUserStats = dispatch => async user => {
2525 }
2626} ;
2727
28- export const loadUserOpponents = ( abortController , onSuccess , onFailure ) => {
28+ export const loadNearbyUsers = ( abortController , onSuccess , onFailure ) => {
2929 axios
30- . get ( '/api/v1/user/opponents ' , { signal : abortController . signal } )
30+ . get ( '/api/v1/user/nearby_users ' , { signal : abortController . signal } )
3131 . then ( camelizeKeys )
3232 . then ( onSuccess )
3333 . catch ( onFailure ) ;
@@ -41,22 +41,22 @@ export const loadSimpleUserStats = (onSuccess, onFailure) => user => {
4141} ;
4242
4343export const sendPremiumRequest = ( requestStatus , userId ) => async dispatch => {
44- try {
45- await axios . post (
46- `/api/v1/user/${ userId } /send_premium_request` ,
47- { status : requestStatus } ,
48- {
49- headers : {
50- 'Content-Type' : 'application/json' ,
51- 'x-csrf-token' : window . csrf_token ,
44+ try {
45+ await axios . post (
46+ `/api/v1/user/${ userId } /send_premium_request` ,
47+ { status : requestStatus } ,
48+ {
49+ headers : {
50+ 'Content-Type' : 'application/json' ,
51+ 'x-csrf-token' : window . csrf_token ,
52+ } ,
5253 } ,
53- } ,
54- ) ;
55- dispatch ( actions . togglePremiumRequestStatus ( ) ) ;
56- } catch ( error ) {
57- dispatch ( actions . setError ( error ) ) ;
58- }
59- } ;
54+ ) ;
55+ dispatch ( actions . togglePremiumRequestStatus ( ) ) ;
56+ } catch ( error ) {
57+ dispatch ( actions . setError ( error ) ) ;
58+ }
59+ } ;
6060
6161const periodToTimeUnit = {
6262 weekly : 'week' ,
@@ -71,26 +71,26 @@ const getDateByPeriod = period => {
7171} ;
7272
7373export const getUsersRatingPage = ( { name, period, withBots } , { attribute, direction } , page , pageSize ) => dispatch => {
74- const queryParamsString = qs . stringify ( {
75- page,
76- page_size : pageSize ,
77- s : `${ attribute } +${ direction } ` ,
78- q : {
79- name_ilike : name ,
80- } ,
81- date_from : getDateByPeriod ( period ) ,
82- with_bots : withBots ,
83- } ) ;
84-
85- axios
86- . get ( `/api/v1/users?${ queryParamsString } ` )
87- . then ( ( { data } ) => {
88- dispatch ( actions . updateUsersRatingPage ( camelizeKeys ( data ) ) ) ;
89- dispatch ( actions . finishStoreInit ( ) ) ;
90- } )
91- . catch ( error => {
92- dispatch ( actions . setError ( error ) ) ;
74+ const queryParamsString = qs . stringify ( {
75+ page,
76+ page_size : pageSize ,
77+ s : `${ attribute } +${ direction } ` ,
78+ q : {
79+ name_ilike : name ,
80+ } ,
81+ date_from : getDateByPeriod ( period ) ,
82+ with_bots : withBots ,
9383 } ) ;
94- } ;
84+
85+ axios
86+ . get ( `/api/v1/users?${ queryParamsString } ` )
87+ . then ( ( { data } ) => {
88+ dispatch ( actions . updateUsersRatingPage ( camelizeKeys ( data ) ) ) ;
89+ dispatch ( actions . finishStoreInit ( ) ) ;
90+ } )
91+ . catch ( error => {
92+ dispatch ( actions . setError ( error ) ) ;
93+ } ) ;
94+ } ;
9595
9696export default loadUserStats ;
0 commit comments