diff --git a/__tests__/__snapshots__/index.js.snap b/__tests__/__snapshots__/index.js.snap index fb0ba447..19789173 100644 --- a/__tests__/__snapshots__/index.js.snap +++ b/__tests__/__snapshots__/index.js.snap @@ -86,6 +86,7 @@ Object { "addSkillInit": [Function], "addWebLinkDone": [Function], "addWebLinkInit": [Function], + "clearProfile": [Function], "deletePhotoDone": [Function], "deletePhotoInit": [Function], "deleteWebLinkDone": [Function], diff --git a/__tests__/actions/__snapshots__/profile.js.snap b/__tests__/actions/__snapshots__/profile.js.snap index 17e184aa..47b779ea 100644 --- a/__tests__/actions/__snapshots__/profile.js.snap +++ b/__tests__/actions/__snapshots__/profile.js.snap @@ -7,6 +7,7 @@ Object { "addSkillInit": [Function], "addWebLinkDone": [Function], "addWebLinkInit": [Function], + "clearProfile": [Function], "deletePhotoDone": [Function], "deletePhotoInit": [Function], "deleteWebLinkDone": [Function], diff --git a/docs/actions.profile.md b/docs/actions.profile.md index e84440c2..3b2bb991 100644 --- a/docs/actions.profile.md +++ b/docs/actions.profile.md @@ -11,6 +11,7 @@ Actions for interactions with profile details API. * [actions.profile](#module_actions.profile) * [.loadProfile(handle)](#module_actions.profile.loadProfile) ⇒ Action + * [.clearProfile()](#module_actions.profile.clearProfile) ⇒ Action * [.getAchievementsInit()](#module_actions.profile.getAchievementsInit) ⇒ Action * [.getAchievementsDone(handle)](#module_actions.profile.getAchievementsDone) ⇒ Action * [.getExternalAccountsInit()](#module_actions.profile.getExternalAccountsInit) ⇒ Action @@ -67,6 +68,17 @@ Creates and action that loads user profile. | --- | --- | --- | | handle | String | User handle. | + + +### actions.profile.clearProfile() ⇒ Action +Creates and action that clear user profile. + +**Kind**: static method of [actions.profile](#module_actions.profile) +**Todo** + +- [ ] This action does not follow the pattern with init/done pairs of + actions. Should be improved. + ### actions.profile.getAchievementsInit() ⇒ Action diff --git a/package-lock.json b/package-lock.json index 09570569..26c39869 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "topcoder-react-lib", - "version": "0.4.8", + "version": "0.4.9", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 05dfd084..88903a7f 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .", "test": "npm run lint && npm run jest" }, - "version": "0.4.8", + "version": "0.4.9", "dependencies": { "auth0-js": "^6.8.4", "isomorphic-fetch": "^2.2.1", diff --git a/src/actions/profile.js b/src/actions/profile.js index 69c4cb99..58dc2cbf 100644 --- a/src/actions/profile.js +++ b/src/actions/profile.js @@ -5,7 +5,7 @@ * should be refactored to avoid redundancy. */ import { createActions } from 'redux-actions'; - +import _ from 'lodash'; import { getService as getUserService } from '../services/user'; import { getService as getMembersService } from '../services/members'; @@ -415,6 +415,7 @@ function updatePasswordDone(profile, tokenV3, newPassword, oldPassword) { export default createActions({ PROFILE: { LOAD_PROFILE: loadProfile, + CLEAR_PROFILE: _.noop, GET_ACHIEVEMENTS_INIT: getAchievementsInit, GET_ACHIEVEMENTS_DONE: getAchievementsDone, GET_EXTERNAL_ACCOUNTS_INIT: getExternalAccountsInit, diff --git a/src/reducers/profile.js b/src/reducers/profile.js index 1fb3bddc..12c734c5 100644 --- a/src/reducers/profile.js +++ b/src/reducers/profile.js @@ -432,6 +432,9 @@ function onUpdatePasswordDone(state, { payload, error }) { function create(initialState) { const a = actions.profile; return handleActions({ + [a.clearProfile]: state => ({ + ...state, achievements: null, country: '', info: null, skills: null, stats: null, + }), [a.loadProfile]: (state, action) => ({ ...state, profileForHandle: action.payload }), [a.getAchievementsInit]: state => state, [a.getAchievementsDone]: onGetAchievementsDone, pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy