Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable dialog for password which is not following rule #1593 #1613

Merged
merged 1 commit into from
Mar 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 20 additions & 5 deletions admin-ui/plugins/user-management/redux/sagas/UserSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ export function* createUserSaga({ payload }) {
yield* triggerWebhook({ payload: { createdFeatureValue: data } })
return data
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(createUserResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -67,7 +68,8 @@ export function* updateUserSaga({ payload }) {
yield* triggerWebhook({ payload: { createdFeatureValue: data } })
return data
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(updateUserResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -86,7 +88,8 @@ export function* changeUserPasswordSaga({ payload }) {
yield put(updateToast(true, 'success'))
yield put(changeUserPasswordResponse(data))
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(changeUserPasswordResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -105,7 +108,8 @@ export function* getUsersSaga({ payload }) {
yield call(postUserAction, audit)
return data
} catch (e) {
yield put(getUserResponse(null))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
yield put(getAPIAccessToken(jwt))
Expand All @@ -126,7 +130,8 @@ export function* deleteUserSaga({ payload }) {
yield* triggerWebhook({ payload: { createdFeatureValue: payload } })
return data
} catch (e) {
yield put(updateToast(true, 'error'))
const errMsg = e?.response?.body?.description || e?.response?.text
yield* errorToast(errMsg)
yield put(deleteUserResponse(null))
if (isFourZeroOneError(e)) {
const jwt = yield select((state) => state.authReducer.userinfo_jwt)
Expand All @@ -136,6 +141,16 @@ export function* deleteUserSaga({ payload }) {
}
}

function* errorToast(errMsg) {
yield put(
updateToast(
true,
'error',
errMsg
)
)
}

export function* watchGetUsers() {
yield takeEvery('user/getUsers', getUsersSaga)
}
Expand Down