Skip to content

Commit

Permalink
fix(admin-ui): use responseMessage to show errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jv18creator committed Aug 18, 2023
1 parent d2f3e7f commit 3a2254d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions admin-ui/app/redux/sagas/LicenseSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ function* retrieveLicenseKey() {
const mauThreshold = activateLicense.responseObject?.find((item) => item?.name === "mau_threshold")
yield* checkMauThreshold(parseInt(mauThreshold?.value))
} catch (error) {
console.log(error)
yield put(setLicenseError(error.responseMessage || error.message))
const errorMessage = error?.response?.body?.responseMessage || error.message
yield put(setLicenseError(errorMessage))
yield put(
retrieveLicenseKeyResponse({ isNoValidLicenseKeyFound: true })
)
Expand All @@ -96,8 +96,9 @@ function* retrieveLicenseKey() {
}
}
} catch (error) {
const errorMessage = error?.response?.body?.responseMessage || error.message
console.log('Error in generating key.', error)
yield put(setLicenseError(error.responseMessage || error.message))
yield put(setLicenseError(errorMessage))
yield put(retrieveLicenseKeyResponse({ isNoValidLicenseKeyFound: true }))
yield put(checkLicensePresentResponse({ isLicenseValid: false }))
yield put(generateTrialLicenseResponse(null))
Expand Down Expand Up @@ -152,16 +153,18 @@ function* generateTrailLicenseKey() {
)
yield put(checkUserLicenseKeyResponse(activateLicense))
} catch (error) {
const errorMessage = error?.response?.body?.responseMessage || error.message
yield put(checkLicensePresentResponse({ isLicenseValid: false }))
yield put(generateTrialLicenseResponse(null))
yield put(setLicenseError(error.message))
yield put(setLicenseError(errorMessage))
}
}
} catch (error) {
const errorMessage = error?.response?.body?.responseMessage || error.message
console.log('Error in generating key.', error)
yield put(checkLicensePresentResponse({ isLicenseValid: false }))
yield put(generateTrialLicenseResponse(null))
yield put(setLicenseError(error.message))
yield put(setLicenseError(errorMessage))
}
}

Expand Down

0 comments on commit 3a2254d

Please sign in to comment.