Skip to content

Commit 0d95f10

Browse files
Merge pull request topcoder-platform#22 from topcoder-platform/develop
Develop
2 parents fd2a23a + daf9822 commit 0d95f10

File tree

7 files changed

+21
-3
lines changed

7 files changed

+21
-3
lines changed

__tests__/__snapshots__/index.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Object {
8686
"addSkillInit": [Function],
8787
"addWebLinkDone": [Function],
8888
"addWebLinkInit": [Function],
89+
"clearProfile": [Function],
8990
"deletePhotoDone": [Function],
9091
"deletePhotoInit": [Function],
9192
"deleteWebLinkDone": [Function],

__tests__/actions/__snapshots__/profile.js.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Object {
77
"addSkillInit": [Function],
88
"addWebLinkDone": [Function],
99
"addWebLinkInit": [Function],
10+
"clearProfile": [Function],
1011
"deletePhotoDone": [Function],
1112
"deletePhotoInit": [Function],
1213
"deleteWebLinkDone": [Function],

docs/actions.profile.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ Actions for interactions with profile details API.
1111

1212
* [actions.profile](#module_actions.profile)
1313
* [.loadProfile(handle)](#module_actions.profile.loadProfile) ⇒ <code>Action</code>
14+
* [.clearProfile()](#module_actions.profile.clearProfile) ⇒ <code>Action</code>
1415
* [.getAchievementsInit()](#module_actions.profile.getAchievementsInit) ⇒ <code>Action</code>
1516
* [.getAchievementsDone(handle)](#module_actions.profile.getAchievementsDone) ⇒ <code>Action</code>
1617
* [.getExternalAccountsInit()](#module_actions.profile.getExternalAccountsInit) ⇒ <code>Action</code>
@@ -67,6 +68,17 @@ Creates and action that loads user profile.
6768
| --- | --- | --- |
6869
| handle | <code>String</code> | User handle. |
6970

71+
<a name="module_actions.profile.clearProfile"></a>
72+
73+
### actions.profile.clearProfile() ⇒ <code>Action</code>
74+
Creates and action that clear user profile.
75+
76+
**Kind**: static method of [<code>actions.profile</code>](#module_actions.profile)
77+
**Todo**
78+
79+
- [ ] This action does not follow the pattern with init/done pairs of
80+
actions. Should be improved.
81+
7082
<a name="module_actions.profile.getAchievementsInit"></a>
7183

7284
### actions.profile.getAchievementsInit() ⇒ <code>Action</code>

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"lint:js": "./node_modules/.bin/eslint --ext .js,.jsx .",
3232
"test": "npm run lint && npm run jest"
3333
},
34-
"version": "0.4.8",
34+
"version": "0.4.9",
3535
"dependencies": {
3636
"auth0-js": "^6.8.4",
3737
"isomorphic-fetch": "^2.2.1",

src/actions/profile.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* should be refactored to avoid redundancy.
66
*/
77
import { createActions } from 'redux-actions';
8-
8+
import _ from 'lodash';
99
import { getService as getUserService } from '../services/user';
1010
import { getService as getMembersService } from '../services/members';
1111

@@ -415,6 +415,7 @@ function updatePasswordDone(profile, tokenV3, newPassword, oldPassword) {
415415
export default createActions({
416416
PROFILE: {
417417
LOAD_PROFILE: loadProfile,
418+
CLEAR_PROFILE: _.noop,
418419
GET_ACHIEVEMENTS_INIT: getAchievementsInit,
419420
GET_ACHIEVEMENTS_DONE: getAchievementsDone,
420421
GET_EXTERNAL_ACCOUNTS_INIT: getExternalAccountsInit,

src/reducers/profile.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,9 @@ function onUpdatePasswordDone(state, { payload, error }) {
432432
function create(initialState) {
433433
const a = actions.profile;
434434
return handleActions({
435+
[a.clearProfile]: state => ({
436+
...state, achievements: null, country: '', info: null, skills: null, stats: null,
437+
}),
435438
[a.loadProfile]: (state, action) => ({ ...state, profileForHandle: action.payload }),
436439
[a.getAchievementsInit]: state => state,
437440
[a.getAchievementsDone]: onGetAchievementsDone,

0 commit comments

Comments
 (0)
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