Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 3 additions & 2 deletions src/actions/sponsor-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
fetchErrorHandler,
postFile
} from "openstack-uicore-foundation/lib/utils/actions";
import debounce from "lodash/debounce"
import debounce from "lodash/debounce";
import URI from "urijs";
import { getAccessTokenSafely } from "../utils/methods";
import { normalizeLeadReportSettings } from "../models/lead-report-settings";
Expand Down Expand Up @@ -195,7 +195,8 @@ export const querySponsors = debounce(async (input, summitId, callback) => {
.then((json) => {
const options = [...json.data].map((sp) => ({
id: sp.id,
name: sp.company.name
name: sp.company.name,
companyId: sp.company.id
}));
callback(options);
})
Expand Down
74 changes: 37 additions & 37 deletions src/actions/sponsor-users-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,46 +504,47 @@ export const deleteSponsorUser =

/** **************** SPONSOR USERS TAB *************************************** */

export const sendSponsorUserInvite = (email) => async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;
const { entity } = currentSponsorState;
export const sendSponsorUserInvite =
(email, sponsorId = null) =>
async (dispatch, getState) => {
const { currentSummitState, currentSponsorState } = getState();
const accessToken = await getAccessTokenSafely();
const { currentSummit } = currentSummitState;
const { entity } = currentSponsorState;

const params = {
access_token: accessToken
};
const params = {
access_token: accessToken
};

dispatch(startLoading());
dispatch(startLoading());

const payload = {
user_email: email,
sponsor_id: entity.id,
summit_id: currentSummit.id
};
const payload = {
user_email: email,
sponsor_id: sponsorId || entity.id,
summit_id: currentSummit.id
};

return postRequest(
null,
createAction(DUMMY_ACTION),
`${window.SPONSOR_USERS_API_URL}/api/v1/sponsor-users`,
payload,
snackbarErrorHandler,
entity
)(params)(dispatch)
.then(() => {
dispatch(stopLoading());
dispatch(
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("sponsor_users.new_user.success")
})
);
})
.catch(console.log) // need to catch promise reject
.finally(() => {
dispatch(stopLoading());
});
};
return postRequest(
null,
createAction(DUMMY_ACTION),
`${window.SPONSOR_USERS_API_URL}/api/v1/sponsor-users`,
payload,
snackbarErrorHandler,
entity
)(params)(dispatch)
.then(() => {
dispatch(stopLoading());
dispatch(
snackbarSuccessHandler({
title: T.translate("general.success"),
html: T.translate("sponsor_users.new_user.success")
})
);
})
.finally(() => {
dispatch(stopLoading());
});
Comment thread
coderabbitai[bot] marked this conversation as resolved.
};

export const fetchSponsorUsersBySummit = async (
currentSummitId,
Expand Down Expand Up @@ -652,7 +653,6 @@ export const importSponsorUsers =
})
);
})
.catch(console.log) // need to catch promise reject
.finally(() => {
dispatch(stopLoading());
});
Expand Down
Loading
Loading