// (C) 2021-2026 GoodData Corporation
import { batchActions } from "redux-batched-actions";
import { call, put } from "redux-saga/effects";
import { convertError } from "@gooddata/sdk-ui";
import { usersActions } from "../../store/users/index.js";
import { loadWorkspaceUsers } from "./loadWorkspaceUsers.js";
export function* loadAllWorkspaceUsersHandler(ctx, _cmd) {
    try {
        yield put(usersActions.setUsersLoadingStatus("loading"));
        const users = yield call(loadWorkspaceUsers, ctx);
        yield put(batchActions([usersActions.setUsers(users), usersActions.setUsersLoadingStatus("success")]));
    }
    catch (e) {
        yield put(batchActions([
            usersActions.setErrorUsers(convertError(e)),
            usersActions.setUsersLoadingStatus("error"),
        ]));
    }
}
//# sourceMappingURL=loadAllUsersHandler.js.map