How to use the topcoder-react-lib.actions.profile function in topcoder-react-lib

To help you get started, we’ve selected a few topcoder-react-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github topcoder-platform / community-app / __tests__ / shared / reducers / page / settings.js View on Github external
updatePasswordDone: mockAction('PROFILE/UPDATE_PASSWORD_DONE'),
    updatePasswordError: mockAction('PROFILE/UPDATE_PASSWORD_DONE', null, 'Unknown error'),
    saveEmailPreferencesDone: mockAction('PROFILE/SAVE_EMAIL_PREFERENCES_DONE'),
    linkExternalAccountDone: mockAction('PROFILE/LINK_EXTERNAL_ACCOUNT_DONE', { data: { providerType } }),
    unlinkExternalAccountInit: mockAction('PROFILE/UNLINK_EXTERNAL_ACCOUNT_INIT', { providerType }),
    unlinkExternalAccountDone: mockAction('PROFILE/UNLINK_EXTERNAL_ACCOUNT_DONE', { providerType }),
    addWebLinkDone: mockAction('PROFILE/ADD_WEB_LINK_DONE'),
    deleteWebLinkInit: mockAction('PROFILE/DELETE_WEB_LINK_INIT', linkToConfirmDelete),
    deleteWebLinkDone: mockAction('PROFILE/DELETE_WEB_LINK_DONE', { handle, data: linkToConfirmDelete }),
    getSkillsDone: mockAction('PROFILE/GET_SKILLS_DONE', { skills: { [skill1.tagId]: skill1 } }),
    addSkillDone: mockAction('PROFILE/ADD_SKILL_DONE', { skill: skill2, skills: { [skill1.tagId]: skill1, [skill2.tagId]: skill2 } }),
    hideSkillDone: mockAction('PROFILE/HIDE_SKILL_DONE', { skill: skill2, skills: { [skill1.tagId]: skill1 } }),
  },
};
jest.setMock(require.resolve('actions/page/settings'), mockActions);
_.merge(actions.profile, mockActions.profile);

const mockToast = {
  toastr: {
    success: jest.fn(),
  },
};
jest.setMock('react-redux-toastr', mockToast);

const reducers = require('reducers/page/settings');

let reducer;

function testReducer(istate) {
  let state;

  beforeEach(() => {
github topcoder-platform / community-app / src / shared / reducers / page / settings.js View on Github external
function create(defaultState = {}) {
  const a = pageActions.page.settings;
  console.log("Entered in page settings reducers");
  
  return handleActions({
    
    [a.selectTab]: (state, { payload }) => ({
      settingsTab: payload.split("/")[0],
      deletingLinks: state.deletingLinks,
      subTab: payload.split("/")[1]
    }),
    [a.selectSubtab]: (state, { payload }) => ({
      subTab: payload,
    }),
    [a.clearIncorrectPassword]: state => ({ ...state, incorrectPassword: false }),
    [actions.profile.getSkillsDone]: mergeSkills,
    [actions.profile.addSkillDone]: mergeSkills,
    [actions.profile.hideSkillDone]: mergeSkills,
    [actions.profile.updateProfileDone]: onUpdateProfileDone,
    [actions.profile.updatePasswordDone]: onUpdatePasswordDone,
    [actions.profile.uploadPhotoDone]: onUploadPhotoDone,
    [actions.profile.deletePhotoDone]: onDeletePhotoDone,
    [actions.profile.saveEmailPreferencesDone]: onSaveEmailPreferencesDone,
    [actions.profile.addWebLinkDone]: onAddWebLinkDone,
    [actions.profile.deleteWebLinkInit]: onDeleteWebLinkInit,
    [actions.profile.deleteWebLinkDone]: onDeleteWebLinkDone,
    [actions.profile.linkExternalAccountDone]: onLinkExternalAccountDone,
    [actions.profile.unlinkExternalAccountInit]: onUnlinkExternalAccountInit,
    [actions.profile.unlinkExternalAccountDone]: onUnlinkExternalAccountDone,
  }, _.defaults(defaultState, {
    settingsTab: TABS.PROFILE,
    deletingLinks: []
github topcoder-platform / community-app / src / shared / containers / Settings.jsx View on Github external
function mapDispatchToProps(dispatch) {
  const profileActions = actions.profile;
  const basicInfoActions= actions.basicInfo;
  const languageActions= actions.language;
  console.log("actions", actions);
  console.log("profileActions", profileActions);
  console.log("basicInfoActions", basicInfoActions);
  
  const loadHeaderData = ({ handle, tokenV3 }) => {
    dispatch(profileActions.loadProfile(handle));
    dispatch(profileActions.getAchievementsInit());
    dispatch(actions.challenge.getActiveChallengesCountInit());
    dispatch(profileActions.getAchievementsDone(handle));
    dispatch(actions.challenge.getActiveChallengesCountDone(handle, tokenV3));
  };

  const loadTabData = ({
    handle,
github topcoder-platform / community-app / src / shared / containers / ProfileStats.jsx View on Github external
function mapDispatchToProps(dispatch) {
  const a = actions.members;
  const pa = actions.profile;

  return {
    loadStats: (handle) => {
      dispatch(a.getStatsInit(handle));
      dispatch(a.getStatsDone(handle));
      dispatch(pa.getInfoInit(handle));
      dispatch(pa.getInfoDone(handle));
      dispatch(a.getActiveChallengesInit(handle));
      dispatch(a.getActiveChallengesDone(handle));
    },
    loadStatsHistoryAndDistribution: (handle, track, subTrack) => {
      dispatch(a.getStatsHistoryInit(handle));
      dispatch(a.getStatsHistoryDone(handle));
      dispatch(a.getStatsDistributionInit(handle));
      dispatch(a.getStatsDistributionDone(handle, track, subTrack));
    },
github topcoder-platform / community-app / src / shared / containers / EmailVerification / index.jsx View on Github external
function mapDispatchToProps(dispatch) {
  const profileActions = actions.profile;

  return {
    verifyMemberNewEmail: (handle, tokenV3, emailVerifyToken) => {
      dispatch(profileActions.verifyMemberNewEmailInit());
      dispatch(profileActions.verifyMemberNewEmailDone(handle, tokenV3, emailVerifyToken));
    },
  };
}
github topcoder-platform / community-app / src / shared / containers / Profile.jsx View on Github external
function mapDispatchToProps(dispatch) {
  const a = actions.profile;
  const lookupActions = actions.lookup;
  return {
    loadProfile: (handle) => {
      dispatch(a.clearProfile());
      dispatch(a.loadProfile(handle));
      dispatch(a.getAchievementsInit());
      dispatch(a.getExternalAccountsInit());
      dispatch(a.getExternalLinksInit());
      dispatch(a.getInfoInit());
      dispatch(a.getSkillsInit());
      dispatch(a.getStatsInit());
      dispatch(lookupActions.getCountriesInit());
      dispatch(a.getAchievementsV3Done(handle));
      dispatch(a.getExternalAccountsDone(handle));
      dispatch(a.getExternalLinksDone(handle));
      dispatch(a.getInfoDone(handle));
github topcoder-platform / community-app / src / shared / reducers / page / settings.js View on Github external
[a.selectSubtab]: (state, { payload }) => ({
      subTab: payload,
    }),
    [a.clearIncorrectPassword]: state => ({ ...state, incorrectPassword: false }),
    [actions.profile.getSkillsDone]: mergeSkills,
    [actions.profile.addSkillDone]: mergeSkills,
    [actions.profile.hideSkillDone]: mergeSkills,
    [actions.profile.updateProfileDone]: onUpdateProfileDone,
    [actions.profile.updatePasswordDone]: onUpdatePasswordDone,
    [actions.profile.uploadPhotoDone]: onUploadPhotoDone,
    [actions.profile.deletePhotoDone]: onDeletePhotoDone,
    [actions.profile.saveEmailPreferencesDone]: onSaveEmailPreferencesDone,
    [actions.profile.addWebLinkDone]: onAddWebLinkDone,
    [actions.profile.deleteWebLinkInit]: onDeleteWebLinkInit,
    [actions.profile.deleteWebLinkDone]: onDeleteWebLinkDone,
    [actions.profile.linkExternalAccountDone]: onLinkExternalAccountDone,
    [actions.profile.unlinkExternalAccountInit]: onUnlinkExternalAccountInit,
    [actions.profile.unlinkExternalAccountDone]: onUnlinkExternalAccountDone,
  }, _.defaults(defaultState, {
    settingsTab: TABS.PROFILE,
    deletingLinks: []
    }));
}