Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function* loadConfig(): Generator {
- try {
- const partnerSlug: string = getPartnerSlug(host)
- const partnerAuthAppKeyResponse: AxiosResponse<IVerificationResponsePayload> = (yield call(
- [api, 'post'],
- 'v1/appkeys/find',
- {
- partnerSlug
- }
- )) as AxiosResponse<IVerificationResponsePayload>
- api.setAppKey(partnerAuthAppKeyResponse.data.authAppKey)
- const partnerConfigResponse: AxiosResponse<IVerificationResponsePayload> = (yield call(
- [api, 'get'],
- 'v1/partners/ui/configuration'
- )) as AxiosResponse<IVerificationResponsePayload>
- const {
- data: { configuration: partnerConfiguration }
- } = partnerConfigResponse
- if (partnerSlug === genericShopPartnerKey) {
- modifyConfig(partnerConfiguration, getGenericPartnerConfig(host))
- } else {
- modifyConfig(partnerConfiguration)
- }
- const root: HTMLElement = document.documentElement
- for (const key of Object.keys(partnerConfiguration.theme)) {
- root.style.setProperty(key, partnerConfiguration.theme[key])
- }
- const errorsResponse: any = yield call(getErrorLabels)
- yield put(succeedPartnerConfigLoading(partnerConfiguration))
- yield put(succeedErrorLabelsLoading(errorsResponse.fields))
- } catch (error) {
- yield put(failPartnerConfigLoading(error))
- yield history.push(StaticRoute.failUrl)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement