Skip to content

Commit 90b380c

Browse files
committed
Cleans up docs for auth actions
1 parent 173c6cf commit 90b380c

File tree

2 files changed

+30
-18
lines changed

2 files changed

+30
-18
lines changed

bin/docgen

+3
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ const fs = require('fs');
1010
const jsdoc2md = require('jsdoc-to-markdown');
1111
const mkpath = require('mkpath');
1212
const path = require('path');
13+
const rimraf = require('rimraf');
14+
15+
rimraf.sync(path.resolve(__dirname, '../_auto_doc_'));
1316

1417
const outputDir = path.resolve(__dirname, '../_auto_doc_');
1518

src/actions/auth.js

+27-18
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
/**
2-
* @module actions/auth
3-
* @desc Auth-related actions.
2+
* @module "actions.auth"
3+
* @desc Actions related to Topcoder authentication system.
44
*/
55

6-
import _ from 'lodash';
76
import { createActions } from 'redux-actions';
87
import { decodeToken } from 'tc-accounts';
98
import { getApiV3 } from '../services/api';
109

1110
/**
12-
* Loads profile of the authenticated user.
13-
* @alias module:actions/auth
14-
* @param {String} userTokenV3 Topcoder auth token V3.
15-
* @return {Promise}
16-
* @fulfil {Object} User profile object.
11+
* @static
12+
* @desc Creates an action that loads Topcoder user profile from v3 API.
13+
* @param {String} userTokenV3 v3 authentication token.
14+
* @return {Action}
1715
*/
1816
function loadProfileDone(userTokenV3) {
1917
if (!userTokenV3) return Promise.resolve(null);
@@ -30,20 +28,31 @@ function loadProfileDone(userTokenV3) {
3028
}
3129

3230
/**
33-
* @function test
34-
* @desc test
31+
* @static
32+
* @desc Creates an action that sets Topcoder v2 authentication token.
33+
* @param {String} tokenV2 Topcoder v2 authentication token.
34+
* @return {Action}
3535
*/
36+
function setTcTokenV2(tokenV2) {
37+
return tokenV2;
38+
}
39+
40+
/**
41+
* @static
42+
* @desc Creates an action that decodes Topcoder v3 authentication token,
43+
* to get user object, and then writes both the token and the user object into
44+
* Redux store.
45+
* @param {String} tokenV3 Topcoder v3 authentication token.
46+
* @return {Action}
47+
*/
48+
function setTcTokenV3(tokenV3) {
49+
return tokenV3;
50+
}
3651

3752
export default createActions({
3853
AUTH: {
3954
LOAD_PROFILE: loadProfileDone,
40-
41-
/* Given TC auth token V2, this action writes it into state.auth.tokenV2. */
42-
SET_TC_TOKEN_V2: _.identity,
43-
44-
/* Given TC auth token V3 this action:
45-
* - Decodes token and writes resulting user object into state.auth.user;
46-
* - Writes the token itself into state.auth.tokenV3. */
47-
SET_TC_TOKEN_V3: _.identity,
55+
SET_TC_TOKEN_V2: setTcTokenV2,
56+
SET_TC_TOKEN_V3: setTcTokenV3,
4857
},
4958
});

0 commit comments

Comments
 (0)