refactor: removed proc object layer in responses (#202)

keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Mirlan 5 years ago committed by GitHub
parent f93fc254f4
commit f41bd3dccd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      src/helpers/callApi/getResponseData.tsx
  2. 1
      src/helpers/index.tsx
  3. 4
      src/requests/getCountries.tsx
  4. 4
      src/requests/getCountryCities.tsx
  5. 4
      src/requests/getLexics.tsx
  6. 4
      src/requests/getMatchInfo.tsx
  7. 4
      src/requests/getMatchLastWatchSeconds.tsx
  8. 4
      src/requests/getMatches/request.tsx
  9. 4
      src/requests/getPlayerInfo.tsx
  10. 4
      src/requests/getSearchItems.tsx
  11. 4
      src/requests/getSportList.tsx
  12. 4
      src/requests/getSportTournaments.tsx
  13. 4
      src/requests/getTeamInfo.tsx
  14. 4
      src/requests/getTournamentInfo.tsx
  15. 4
      src/requests/getUserInfo.tsx
  16. 4
      src/requests/getUserSportFavs.tsx
  17. 4
      src/requests/getUserSubscriptions.tsx

@ -1,3 +0,0 @@
export const getResponseData = (proc: string) => (response: any) => (
response?.[proc]
)

@ -1,5 +1,4 @@
export * from './callApi'
export * from './callApi/getResponseData'
export * from './token'
export * from './getProfileLogo'
export * from './getProfileFallbackLogo'

@ -1,5 +1,5 @@
import { DATA_URL, PROCEDURES } from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.lst_c_country
@ -25,5 +25,5 @@ export const getCountries = (): Promise<Countries> => {
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -1,5 +1,5 @@
import { DATA_URL, PROCEDURES } from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_cities
@ -24,5 +24,5 @@ export const getCountryCities = (query: string, countryId: number): Promise<Citi
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -1,5 +1,5 @@
import { DATA_URL, PROCEDURES } from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.param_lexical
@ -26,5 +26,5 @@ export const getLexics = (lang: string, lexicIds: Array<number>): Promise<Transl
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -3,7 +3,7 @@ import {
PROCEDURES,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
import { MatchStatuses } from 'features/HeaderFilters'
@ -43,5 +43,5 @@ export const getMatchInfo = (sportId: number, matchId: number)
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -3,7 +3,7 @@ import {
PROCEDURES,
SportTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_user_match_second
@ -34,7 +34,7 @@ export const getMatchLastWatchSeconds = async (
const response: Response = await callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
return {
half: response?._p_half ?? 0,

@ -1,5 +1,5 @@
import { DATA_URL } from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
import type { MatchesResponse, MatchesBySection } from './types'
@ -17,7 +17,7 @@ export const requestMatches = async (config: Config): Promise<MatchesBySection>
}: MatchesResponse = await callApi({
config,
url: DATA_URL,
}).then(getResponseData(config.body.proc))
})
return {
broadcast: data.broadcast || [],

@ -3,7 +3,7 @@ import {
PROCEDURES,
SportTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_player_info
@ -44,5 +44,5 @@ export const getPlayerInfo = (
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -3,7 +3,7 @@ import {
PROCEDURES,
SportTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_players_teams_tournaments
@ -76,5 +76,5 @@ export const getSearchItems = (
abortSignal,
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -3,7 +3,7 @@ import {
PROCEDURES,
SportTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_sport_list
@ -23,5 +23,5 @@ export const getSportList = (): Promise<SportList> => {
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -3,7 +3,7 @@ import {
PROCEDURES,
SportTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_tournament_list
@ -47,5 +47,5 @@ export const getSportTournaments = (
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -3,7 +3,7 @@ import {
PROCEDURES,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_team_info
@ -36,5 +36,5 @@ export const getTeamInfo = (sportId: number, teamId: number)
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -2,7 +2,7 @@ import {
DATA_URL,
PROCEDURES,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_tournament_info
@ -35,5 +35,5 @@ export const getTournamentInfo = (sportId: number, tournamentId: number)
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -2,7 +2,7 @@ import {
DATA_URL,
PROCEDURES,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
import type { UserInfo } from 'requests/saveUserInfo'
const proc = PROCEDURES.get_user_info
@ -15,5 +15,5 @@ export const getUserInfo = (): Promise<UserInfo> => {
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -4,7 +4,7 @@ import {
SportTypes,
ProfileTypes,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_user_favorites
@ -51,5 +51,5 @@ export const getUserFavorites = (): Promise<UserFavorites> => {
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

@ -2,7 +2,7 @@ import {
DATA_URL,
PROCEDURES,
} from 'config'
import { callApi, getResponseData } from 'helpers'
import { callApi } from 'helpers'
const proc = PROCEDURES.get_user_subscriptions
@ -34,5 +34,5 @@ export const getUserSubscriptions = (): Promise<UserSubscription> => {
return callApi({
config,
url: DATA_URL,
}).then(getResponseData(proc))
})
}

Loading…
Cancel
Save