diff --git a/README.md b/README.md
index 6b6ecad..7a45d7e 100644
--- a/README.md
+++ b/README.md
@@ -5,11 +5,11 @@
# RSSR Boilerplate
-"We are no better than no one, We are not in competition with anyone, We want to be the best version of ourselves."
+"We are not better than anyone, We are not in competition with anyone, We want to be the best version of ourselves."
-welcome to RSSR. Being here is a sign of your professionalism.
+Welcome to RSSR. Being here is a sign of your professionalism.
-RSSR is a SSR boilerplate for React js and contian:
+RSSR is a SSR boilerplate for React js and contains:
- SSR (Server Side Rendering)
- User Authentication Structure
- SEO optimization utilities
@@ -17,21 +17,21 @@ RSSR is a SSR boilerplate for React js and contian:
- and more …
## Documentation
-see [Documentation](https://github.com/rssr-org/RSSR-Documentation) in github.
+See [Documentation](https://github.com/rssr-org/RSSR-Documentation) in github.
-you can see also videos of RSSR team in [aparat](https://www.aparat.com/user/video/user_list/userid/722589/usercat/413997) and [youtube](https://www.youtube.com/channel/UCNkuorlYEWReSMglMp25yCw), .
+You can also watch videos of RSSR team at [aparat](https://www.aparat.com/user/video/user_list/userid/722589/usercat/413997) and [youtube](https://www.youtube.com/channel/UCNkuorlYEWReSMglMp25yCw), .
## Usage Notice
-core of RSSR is stable but need some changes to be released publicly. you can fork, review and star it but until the final release DONT USE it for your enterprise projects!
+The core of RSSR is stable but needs some changes before it can be released publicly. You can fork, review and star it but DO NOT USE it for your enterprise projects until the final release!
-To be informed, track here or [Telegram channel](https://t.me/rssr_org).
+For more information, follow us at : [Telegram channel](https://t.me/rssr_org).
## Know more
#### what is SSR?
Server Side Rendering is a popular technique for rendering a normally
-client-side only single page app (SPA) on the server and then sending
+client-side single page app (SPA) on the server and then sending
a fully rendered page to the client. The client’s JavaScript bundle
can then take over and the SPA can operate as normal. One major
benefit of using SSR is in having an app that can be crawled
@@ -55,4 +55,4 @@ With every new project that you start, you will be repeating yourself.
This is where boilerplates come in. A boilerplate is a template that
you can clone and reuse for every project.
-
\ No newline at end of file
+
diff --git a/provider/server/development.js b/provider/server/development.js
index bf7277f..00c0e9e 100644
--- a/provider/server/development.js
+++ b/provider/server/development.js
@@ -32,7 +32,7 @@ app.use(express.static(PUBLIC_NAME))
// create webpack compiler
const compiler = webpack(config)
-// make bundled project source files accessable from memory
+// make bundled project source files accessible from memory
app.use(webpackDevMiddleware(compiler, {
publicPath: DIST_ROUTE,
serverSideRender: true
diff --git a/provider/server/production.js b/provider/server/production.js
index 09a75b7..0f44833 100644
--- a/provider/server/production.js
+++ b/provider/server/production.js
@@ -19,7 +19,7 @@ const app = express()
// cookie
app.use(cookieParser())
-// make bundled final project source files accessable
+// make bundled final project source files accessible
app.use(DIST_ROUTE, express.static(DIST_PATH))
// load static files
diff --git a/provider/setup/envLoader.js b/provider/setup/envLoader.js
index 7886534..0d6cc5e 100644
--- a/provider/setup/envLoader.js
+++ b/provider/setup/envLoader.js
@@ -1,11 +1,11 @@
-// load environment varibale of .env file
+// load environment variable of .env file
const dotenv = require('dotenv')
dotenv.config()
-// load environment varibale of .env.[NODE_ENV] files
+// load environment variable of .env.[NODE_ENV] files
const fs = require('fs')
const envPath = fs.readFileSync('.env.' + process.env.NODE_ENV);
const envConfig = dotenv.parse(envPath)
for (const k in envConfig) {
process.env[k] = envConfig[k]
-}
\ No newline at end of file
+}
diff --git a/provider/setup/fileVersion.js b/provider/setup/fileVersion.js
index 70a63be..519222c 100644
--- a/provider/setup/fileVersion.js
+++ b/provider/setup/fileVersion.js
@@ -23,7 +23,7 @@ switch (process.env.FILE_VERSION_TYPE) {
global.FILE_VERSION = '?v=' + versionHash(); // random 24 char string
break;
case 'disable':
- global.FILE_VERSION = ''; // with out version
+ global.FILE_VERSION = ''; // without version
break;
default:
console.error('env.FILE_VERSION is not valid!', global.FILE_VERSION)
diff --git a/provider/setup/rateLimit.js b/provider/setup/rateLimit.js
index 2583a90..17648dd 100644
--- a/provider/setup/rateLimit.js
+++ b/provider/setup/rateLimit.js
@@ -1,4 +1,4 @@
-// limit request numbet
+// limit request number
const rateLimit = require("express-rate-limit");
/**
@@ -14,9 +14,9 @@ module.exports = function (app) {
const limiter = rateLimit({
windowMs: 60 * 1000, // 1 minutes
- max: 20 // 20 request in each 1 minutes
+ max: 20 // 20 requests in each 1 minute
});
- // apply to all requests with out load static file (becuse defined in above)
+ // apply to all requests without loading static file (because defined in above)
app.use(limiter);
-}
\ No newline at end of file
+}
diff --git a/src/App/Home/Home.js b/src/App/Home/Home.js
index b720e84..4241703 100644
--- a/src/App/Home/Home.js
+++ b/src/App/Home/Home.js
@@ -23,7 +23,7 @@ function Home(props) {
RSSR Boilderplate
- We are no better than no one,
+ We are no better than anyone else,
We are not in competition with anyone,
We want to be the best version of ourselves.
diff --git a/src/Component/Auth/SignIn/ForgetPasswordForm.js b/src/Component/Auth/SignIn/ForgetPasswordForm.js
index d500cbb..b4642fc 100644
--- a/src/Component/Auth/SignIn/ForgetPasswordForm.js
+++ b/src/Component/Auth/SignIn/ForgetPasswordForm.js
@@ -22,7 +22,7 @@ function ForgetPasswordForm(props) {
// method: 'POST',
data: {
"email": email,
- // server most be add token number to end of url and redirect to it
+ // server must add token number to end of url and redirect to it
"callback": window.location.origin + route.resetPassword('')
}
})
@@ -31,11 +31,11 @@ function ForgetPasswordForm(props) {
Recovery email sent.
- Please check your email inbox or smap and click on link.
+ Please check your email inbox or spam and click on link.
{email}
- Apply again if you do not receive it.
+ Apply again if you did not receive it.
);
toast.success(message, {autoClose: false});
@@ -69,7 +69,7 @@ function ForgetPasswordForm(props) {
value={email}
onChange={(e) => setEmail(e.target.value)}
required/>
-
E-mail is not valid. please enter your account email like: sample@gmail.com
+
E-mail is not valid. please enter your email account like: sample@gmail.com
Recovery
@@ -78,4 +78,4 @@ function ForgetPasswordForm(props) {
)
}
-export default connect(s => ({localUser: s.localUser}))(ForgetPasswordForm);
\ No newline at end of file
+export default connect(s => ({localUser: s.localUser}))(ForgetPasswordForm);
diff --git a/src/Component/Auth/SignIn/SignInForm.js b/src/Component/Auth/SignIn/SignInForm.js
index f0ead8c..00e6b75 100644
--- a/src/Component/Auth/SignIn/SignInForm.js
+++ b/src/Component/Auth/SignIn/SignInForm.js
@@ -30,7 +30,7 @@ function SignInForm(props) {
data: {email: userName, password: password}
})
.then((response) => {
- // set token to localStorage if remember me checked and get user details
+ // set token to localStorage if remember me is checked and get user details
signingIn(response.data.token, rememberMe)
.then(function () {
toast.success('logged-in successfully!', {autoClose: 1200});
@@ -102,4 +102,4 @@ function SignInForm(props) {
);
}
-export default connect(s => ({localUser: s.localUser}))(SignInForm);
\ No newline at end of file
+export default connect(s => ({localUser: s.localUser}))(SignInForm);
diff --git a/src/Component/Auth/__action/firstSetup.js b/src/Component/Auth/__action/firstSetup.js
index fb19190..ff7cece 100644
--- a/src/Component/Auth/__action/firstSetup.js
+++ b/src/Component/Auth/__action/firstSetup.js
@@ -6,12 +6,12 @@ export const firstSetup = function () {
const token = Cookies.get('localUserToken');
if (token) {
// Real user
- // when token exist mean in the past one user logged-in
- // but does not mean user is a valid user, so token need authentication.
+ // when token exists it means that one user has logged-in before
+ // but it does not mean that the user is valid, so token needs authentication.
//
- // when server say token is valid then it's a Real and Valid user, and
- // when server say is NOT valid then runing signingOut() method and
- // set user as Guest user and remove token from localstorage.
+ // when the server says the token is valid, then it's a real and valid user, and
+ // when the server says it is NOT valid then signingOut() method will run and
+ // we set user as a Guest user and remove token from localstorage.
authentication(token)
.then(() => {
/**
@@ -27,4 +27,4 @@ export const firstSetup = function () {
// Guest user
setLocalUserAsGuest()
}
-}
\ No newline at end of file
+}
diff --git a/src/Component/Auth/__action/setLocalUserAsGuest.js b/src/Component/Auth/__action/setLocalUserAsGuest.js
index e5712fb..60934bf 100644
--- a/src/Component/Auth/__action/setLocalUserAsGuest.js
+++ b/src/Component/Auth/__action/setLocalUserAsGuest.js
@@ -2,9 +2,9 @@ import {setStore} from "trim-redux";
/**
- * set "updated: true" to stop loading of need Authentication Components and
- * set "token: null" becuse user is invalid (is guest)
- * NOTICE: localUser of guest user does not "detail" property.
+ * set "updated: true" when the user authentication is done by server and the user information is updated and final
+ * set "token: null" when user is invalid (is guest)
+ * NOTICE: The localUser object of guest user does not have "detail" property.
*/
export const setLocalUserAsGuest = function () {
setStore({localUser: {updated: true, token: null}});
diff --git a/src/Component/Auth/__action/signingIn.js b/src/Component/Auth/__action/signingIn.js
index a402949..1153150 100644
--- a/src/Component/Auth/__action/signingIn.js
+++ b/src/Component/Auth/__action/signingIn.js
@@ -4,13 +4,13 @@ import Cookies from "js-cookie";
/**
* signing in user
* push token to localStorage (change null to token string) just when user checked "remember me" checkbox.
- * NOTICE: if user do not checked "remember me" stay logged-in Until the page refreshes.
+ * NOTICE: if user did not check the "remember me" checkbox, stay logged-in until the page refreshes.
*
* @param token : user authentication key. like "eyJ0eXAiOiJKV1QiLCJhbGciOiJ...."
* @param rememberMe : state of "remember me" checkbox checked
*/
export const signingIn = (token, rememberMe) => {
- // set local User Token when rememberMe
+ // set local user token when rememberMe is checked
if (rememberMe)
Cookies.set('localUserToken', token)
diff --git a/src/Component/Auth/__action/signingOut.js b/src/Component/Auth/__action/signingOut.js
index 0cbebb0..db7dca1 100644
--- a/src/Component/Auth/__action/signingOut.js
+++ b/src/Component/Auth/__action/signingOut.js
@@ -4,7 +4,7 @@ import Cookies from "js-cookie";
/**
* signing out user
- * clear localUser data in redux and set Gust User value to it.
+ * clear localUser data in redux and set Guest User value to it.
*/
export const signingOut = () => {
// clear user detail from redux
@@ -16,4 +16,4 @@ export const signingOut = () => {
/**
* @@@ Clear_USER_Cart
*/
-}
\ No newline at end of file
+}
diff --git a/src/Partial/fetcher/DefaultErrors.js b/src/Partial/fetcher/DefaultErrors.js
index 17ee538..922039a 100644
--- a/src/Partial/fetcher/DefaultErrors.js
+++ b/src/Partial/fetcher/DefaultErrors.js
@@ -4,8 +4,8 @@ import Error404 from "../../App/Error404/Error404";
import {browserHistory} from "../../setup/browserHistory";
-// use for catch axios error in fetching proccess with fetcher
-// NOTICE: all non0-200 response status catch by this view unless you write catch in fetch function for them
+// use for catching axios error during the fetching process with fetcher
+// NOTICE: all non0-200 response status will be catched by this view unless you write catch in fetch function for them
const DefaultErrors = (props) => {
const {status, code, data} = props.data;
@@ -33,4 +33,4 @@ const DefaultErrors = (props) => {
);
};
-export default DefaultErrors;
\ No newline at end of file
+export default DefaultErrors;
diff --git a/src/Partial/fetcher/clientFetcher.js b/src/Partial/fetcher/clientFetcher.js
index c5d4efe..f6d0117 100644
--- a/src/Partial/fetcher/clientFetcher.js
+++ b/src/Partial/fetcher/clientFetcher.js
@@ -12,11 +12,11 @@ import axios from "axios";
/**
* provider Fetcher HOC of client side
*
- * Fetcher is a HOC and wrap 'TheComponent'
- * to can handel fetching data actions of 'TheComponent'.
- * Fetcher in client contian all fetch actions.
+ * Fetcher is a HOC which wraps 'TheComponent'
+ * in order to handle fetching data actions of 'TheComponent'.
+ * Fetcher in client contians all fetch actions.
*
- * @param TheComponent : React Compoentn
+ * @param TheComponent : React Component
* @returns {Fecher} : Fetcher HOC of client side
*/
export const clientFetcher = function (TheComponent) {
@@ -110,7 +110,7 @@ export const clientFetcher = function (TheComponent) {
const defaultValue = defaultState[stateName];
setStore(stateName, defaultValue);
- // when try to fetch but last equal fetch was not complited
+ // when try to fetch but the last equal fetch was not completed
if (this.cancelRequest) {
this.cancelRequest();
delete this.cancelRequest;
@@ -129,8 +129,8 @@ export const clientFetcher = function (TheComponent) {
- // update when route update. for example click on like '/post/2' in mounted component with path '/post/1'
- // needFetch() need for switch between 2 route path with equal component
+ // update when route updates. For example click on '/post/2' in mounted component with path '/post/1'
+ // needFetch() needs switching between 2 route paths with equal component
componentDidUpdate(prevProps) {
if (this.props.location.key === prevProps.location.key && !this.needFetch())
return;
diff --git a/src/Partial/fetcher/serverFetcher.js b/src/Partial/fetcher/serverFetcher.js
index 9a01807..75894ce 100644
--- a/src/Partial/fetcher/serverFetcher.js
+++ b/src/Partial/fetcher/serverFetcher.js
@@ -6,12 +6,10 @@ import DefaultErrors from "./DefaultErrors";
/**
* provider Fetcher HOC of server side
*
- * Fetcher HOC in server just an interface
- * to pass duct to 'TheComponent' when type of fetch is props base
- * an in redux base is an empty component
- * (need empty component to avoid React 'compoenet not found' error)
+ * Fetcher HOC in server is just an interface which passes the fetched data in
+ * redux state to 'TheComponent'
*
- * @param TheComponent : React Compoentn
+ * @param TheComponent : React Component
* @returns {Fecher} : Fetcher HOC of server side
*/
export const serverFetcher = function (TheComponent, stateName) {
diff --git a/src/Partial/skeleton/debugLog.js b/src/Partial/skeleton/debugLog.js
index 2a64a7d..1122137 100644
--- a/src/Partial/skeleton/debugLog.js
+++ b/src/Partial/skeleton/debugLog.js
@@ -1,4 +1,4 @@
-// active switch for debuging logs
+// active switch for debugging logs
const debug = JSON.parse(process.env.RSSR_SKELETON_DEBUG);
export const debugLog = function (msgKey) {
@@ -8,16 +8,16 @@ export const debugLog = function (msgKey) {
let msg;
switch (msgKey) {
case "INVALID_CACHE_VALUE":
- msg = 'cache property is not number or more than ziro miliseconds. set skeleton cache parameter.';
+ msg = 'cache property is not number or more than zero milliseconds. set skeleton cache parameter.';
break;
case "WENT_WELL":
- msg = 'everything went well, data successfully fetched in Server and received on Client.';
+ msg = 'everything went well, data was successfully fetched in Server and was received by Client.';
break;
case "FETCHED_IN_CLIENT":
- msg = 'fetch errored in server but data successfully fetched in Client.';
+ msg = 'fetch errored in server but data was successfully fetched in Client.';
break;
case "CLIENT_ERRORED":
- msg = 'fetch errored in both side.the default data is now used.';
+ msg = 'fetch had error in both sides.The default data is now used.';
break;
case "READ_FROM_CACHE":
msg = 'read data from cache.';
@@ -32,10 +32,10 @@ export const debugLog = function (msgKey) {
msg = 'fetching data from API.';
break;
case "SUCCESSFULLY_FETCH":
- msg = 'data fetched successfully in server and pushed to skeleton state.';
+ msg = 'data was fetched successfully in server and pushed to skeleton state.';
break;
case "SERVER_ERRORED":
- msg = 'fetch errored in server.';
+ msg = 'fetch had error in server.';
break;
default:
msg = 'message key is invalid!'
diff --git a/src/Partial/skeleton/skeleton.js b/src/Partial/skeleton/skeleton.js
index 623bb2a..9930e3a 100644
--- a/src/Partial/skeleton/skeleton.js
+++ b/src/Partial/skeleton/skeleton.js
@@ -11,7 +11,7 @@ export const skeleton = function (TheComponent, fetchFn, cache) {
}
const Skeleton = function (props) {
- // refetch skeleton on client when server fetch skeleton error
+ // refetch skeleton in client when server fetch skeleton encounters an error
if (typeof window !== 'undefined')
skeletonClientProvider(fetchFn)
diff --git a/src/Partial/skeleton/skeletonClientProvider.js b/src/Partial/skeleton/skeletonClientProvider.js
index a386f93..1b73ebe 100644
--- a/src/Partial/skeleton/skeletonClientProvider.js
+++ b/src/Partial/skeleton/skeletonClientProvider.js
@@ -7,7 +7,7 @@ import {debugLog} from "./debugLog";
export const skeletonClientProvider = function (fetchFn) {
- // when server fetch data successfully
+ // when server fetches data successfully
const skeleton = getStore('skeleton');
if (skeleton && !skeleton.isErrorData) {
debugLog('WENT_WELL')
diff --git a/src/Partial/skeleton/skeletonServerProvider.js b/src/Partial/skeleton/skeletonServerProvider.js
index e3ef9f4..385862e 100644
--- a/src/Partial/skeleton/skeletonServerProvider.js
+++ b/src/Partial/skeleton/skeletonServerProvider.js
@@ -14,7 +14,7 @@ let fetchLock = false;
* call skeleton fetch and handle errors
*/
export const skeletonServerProvider = async function (DUCT) {
- // skeleton is disable
+ // skeleton is disabled
if (!App.skeleton)
return true;
@@ -66,7 +66,7 @@ const skeletonFetch = async function (DUCT) {
/**
- * 1) response vaidation
+ * 1) response validation
* 2) push data to updatedState (redux)
*/
function skeletonGetDataFromApi(DUCT) {
diff --git a/src/render/client.js b/src/render/client.js
index f798e3e..622b58e 100644
--- a/src/render/client.js
+++ b/src/render/client.js
@@ -25,7 +25,7 @@ import "bootstrap/dist/css/bootstrap.min.css";
if (!window.RSSR_PROCCESS_ERROR) {
- // define public structur and varibales
+ // define public structure and variables
localStorageSetup();
// create redux store with posted value from "RSSR_UPDATED_REDUX_STATES"
@@ -34,7 +34,7 @@ if (!window.RSSR_PROCCESS_ERROR) {
// root element of application
const appWrap = document.getElementById('app-root');
- // clinet app
+ // client app
const app = (
@@ -45,7 +45,7 @@ if (!window.RSSR_PROCCESS_ERROR) {
)
- // render on client with hydrate() and render() when has not Child Nodes
+ // render on client with hydrate() and render() when does not have Child Nodes
const isMarkupPresent = appWrap.hasChildNodes();
const method = isMarkupPresent ? reactDom.hydrate : reactDom.render;
method(app, appWrap);
diff --git a/src/render/server/fetchProvider.js b/src/render/server/fetchProvider.js
index 25ea668..08e1012 100644
--- a/src/render/server/fetchProvider.js
+++ b/src/render/server/fetchProvider.js
@@ -9,7 +9,7 @@ export const fetchProvider = async function (DUCT) {
// const fetch = als.get('fetch')
const fetch = DUCT.fetch
- // when component has not fetch() then fetch is undefined and fetchType is 'WITH_OUT_FETCH'
+ // when component does not have fetch() then fetch is undefined and fetchType is 'WITH_OUT_FETCH'
if (!fetch) {
debugLog('with out FETCH', DUCT)
return true
@@ -25,7 +25,7 @@ export const fetchProvider = async function (DUCT) {
query: DUCT.req.query //exp: {foo:'bar'} in 'http://www.site.com/post/1?foo=bar'
}
- // NOTICE: catch() will be handel on the server.js with failedRes()
+ // NOTICE: catch() will be handled on the server.js with failedRes()
await
fetch(ftechParams)
.then(function (response) {
@@ -43,12 +43,12 @@ export const fetchProvider = async function (DUCT) {
/**
- * 1) response vaidation
+ * 1) response validation
* 2) set response status code
* 3) push data to updatedState (redux)
*/
function fetchResponsePreparing(DUCT, response) {
- // excute 'throw new Error' if response is not valid
+ // execute 'throw new Error' if response is not valid
responseValidation(response)
// set response status code
@@ -63,7 +63,7 @@ function fetchResponsePreparing(DUCT, response) {
// als.set('updatedState', updatedState, true)
DUCT.updatedState = updatedState
- // use for improve SEO
+ // use for improving SEO
if (response.schema)
DUCT.schema = response.schema;
// als.set('schema', response.schema, true)
@@ -73,7 +73,7 @@ function fetchResponsePreparing(DUCT, response) {
-// active switch for debuging logs
+// active switch for debugging logs
const debug = JSON.parse(process.env.RSSR_FETCHER_DEBUG);
function debugLog(msg, DUCT) {
diff --git a/src/render/server/initialize.js b/src/render/server/initialize.js
index 115d401..5eb0e94 100644
--- a/src/render/server/initialize.js
+++ b/src/render/server/initialize.js
@@ -3,12 +3,12 @@ import {routeMap} from "../../setup/routeMap";
-// define public structur and varibales
+// define public structure and variables
export const initialize = function (DUCT) {
/** updatedState **/
// we use updatedState to set value of RSSR_UPDATED_REDUX_STATES in index template
- // to pass data to the client for syncing reduxes and merge with defaultState
- // of 'stateName' to creare store on the server
+ // to pass data to the client for syncing redux and merge with defaultState
+ // of 'stateName' to create store on the server
DUCT.updatedState = {}
@@ -16,9 +16,9 @@ export const initialize = function (DUCT) {
/** match **/
/*
- * CONSTATN {undefined || object}
+ * CONSTANT {undefined || object}
*
- * match is match object of react-router-dom
+ * match is the match object of react-router-dom
* match of "site.com/post/1" is { path: '/post/:postId', url: '/post/1', isExact: true, params: {postId: '1'} }
*/
const matchedRouteMapItem = routeMap.find(route => {
@@ -33,7 +33,7 @@ export const initialize = function (DUCT) {
// can not match to any route map item
if (matchedRouteMapItem === undefined)
- throw new Error('⛔ can not match to any route map item! define "*" path for not matched routes to can handle e-404, page not found errors.');
+ throw new Error('⛔ can not match to any route map item! define "*" path for not matched routes to be able to handle e-404, page not found errors.');
@@ -49,7 +49,7 @@ export const initialize = function (DUCT) {
/** fetch **/
/*
- * CONSTATN {function || undefinded}
+ * CONSTANT {function || undefinded}
*
* fetch() method of component of matched route item
* when component has not fetch() then fetch is undefined
@@ -59,7 +59,7 @@ export const initialize = function (DUCT) {
/** stateName **/
/*
- * CONSTATN {string}
+ * CONSTANT {string}
*
* stateName is name of 'stateName' state and define when fetch type is
*/
diff --git a/src/render/server/render.js b/src/render/server/render.js
index bd07ddc..a482942 100644
--- a/src/render/server/render.js
+++ b/src/render/server/render.js
@@ -12,7 +12,7 @@ import Error from "../Template/Error";
/**
- * render view on the server and send response as HTML to client
+ * to render view on the server and send response as HTML to client
*/
export const render = function (error, DUCT) {
let view;
@@ -36,7 +36,7 @@ export const render = function (error, DUCT) {
);
} else {
- // when occer error during fetch and proccess
+ // when error occured during fetch and process
errorLogger('SERVER >', error, false, DUCT.req);
view = (
diff --git a/src/render/server/server.js b/src/render/server/server.js
index 098aab3..852c093 100644
--- a/src/render/server/server.js
+++ b/src/render/server/server.js
@@ -41,9 +41,9 @@ export default function serverRenderer() {
// call fetch() of component and get data
fetchProvider(DUCT)
.then(() => response()) // get data successfully
- .catch((err) => response(err)); // occur error in fetchProvider() or render()
+ .catch((err) => response(err)); // return error if any occured in fetchProvider() or render()
} catch (err) {
- response(err) // occur error in try
+ response(err) // return error occurance in try
}
}
}
diff --git a/src/setup/api.js b/src/setup/api.js
index 8dadb66..2415486 100644
--- a/src/setup/api.js
+++ b/src/setup/api.js
@@ -3,7 +3,7 @@
* exp:
* if you get home page data from 'https://api.site.com/home, you must
* define 'https://api.site.com' as API_HOST_IN_CLIENT and API_HOST_IN_SERVER
- * in .env file in root of project, then in below api object define 'home' property with '/home' value
+ * in .env file in root of project, then in api object down below define 'home' property with '/home' value
* and in fetchData method use 'api.home' to access to api url.
*/
let api = {
diff --git a/src/setup/axiosConfig.js b/src/setup/axiosConfig.js
index 2f027ed..1ed2672 100644
--- a/src/setup/axiosConfig.js
+++ b/src/setup/axiosConfig.js
@@ -3,7 +3,7 @@ import {API_DOMAIN} from "./constant";
// set Global axios defaults
axios.defaults.baseURL = API_DOMAIN;
-axios.defaults.timeout = 58000; // fix uncontroled server 502 Error
+axios.defaults.timeout = 58000; // fix uncontrolled server 502 Error
/************************* AXIOS template *************************
axios({
@@ -25,4 +25,4 @@ axios.defaults.timeout = 58000; // fix uncontroled server 502 Error
})
- ***************************************************************/
\ No newline at end of file
+ ***************************************************************/
diff --git a/src/setup/localStorage.js b/src/setup/localStorage.js
index 860e10c..fce8a29 100644
--- a/src/setup/localStorage.js
+++ b/src/setup/localStorage.js
@@ -5,16 +5,16 @@ export default function () {
/**
* version
*
- * we set static version for each important release to can remove some value of some version.
+ * we set static version for each important release to be able to remove some values in some versions.
* first version is 1 and add one in each time.
*/
const version = 1;
- // define version for first time
+ // define version for the first time
if (storage('version') === null)
storage('version', version);
- // available version in localstorage (sometime meaning previous version)
+ // available version in localstorage (sometimes meaning previous version)
const nowVersion = storage('version');
@@ -24,7 +24,7 @@ export default function () {
/**
* UPDATE
*
- * you can access to last value by version number for remove or edit
+ * you can access to last value by version number for removing or editing
*/
if (nowVersion !== version) {
// UPDATE sample:
diff --git a/src/setup/route.js b/src/setup/route.js
index abb5988..f7600e1 100644
--- a/src/setup/route.js
+++ b/src/setup/route.js
@@ -8,6 +8,6 @@ export const route = {
}
-// for improve DX
+// for improving DX
route.signIn = route.sign('in')
-route.signUp = route.sign('up')
\ No newline at end of file
+route.signUp = route.sign('up')
diff --git a/src/setup/store.js b/src/setup/store.js
index 021c452..936692f 100644
--- a/src/setup/store.js
+++ b/src/setup/store.js
@@ -8,15 +8,15 @@ import {IS_BROWSER} from "./constant";
/**
* Redux states
*
- * each item in this list is a one state in redux store
- * and value of this is default value
+ * each item in this list is one state in redux store
+ * and value of this is the default value
*/
export const defaultState = {
localUser: {updated: false, token: null, detail: null},
post: null,
homepage: {isLoading: true},
skeleton: {
- // when occur error in both client and server then skeleton contain this data
+ // when error occurs in both client and server then skeleton contains this data
dailyMessage: 'opps! occur error'
}
}
@@ -44,10 +44,11 @@ if (JSON.parse(process.env.RSSR_REDUX_DEV_TOOLS) && IS_BROWSER)
/**
* create Redux Store
*
- * cearte store with defaultState
- * but in server rendering each state changed (exp: data of home page fetched in server and set to home state)
- * then store create with changed state (in top exp, home state has real data but other state have default data or empty)
- *
+ * create store with defaultState
+ * in server rendering, we do not have to make the store only by defining default state. In case of any state changes, we can
+ * replace defaultState with the changed state and rewrite them.
+ * (exp: in home page we have a data fetch, so we replace it with defaultState. In this example, home state has real data
+ * but other states have default data or remain empty
* @param state : object of states with default value
* @returns {any} : redux store object
*/
@@ -58,7 +59,7 @@ export const createStore = (state = {...defaultState}) => createStoreProvider(st
/**
- * create store with combine server feched data and default store states
+ * create store by combining server feched data and default store states
* @returns {any} : redux store object
*/
export const clientCreateStore = function () {
diff --git a/src/setup/utility/errorLogger.js b/src/setup/utility/errorLogger.js
index 31a665d..aeb9ad2 100644
--- a/src/setup/utility/errorLogger.js
+++ b/src/setup/utility/errorLogger.js
@@ -1,8 +1,8 @@
/**
- * log axios error to console
+ * log axios errors to console
*/
export const errorLogger = (title, error, ignoreMessage, req) => {
- // get uesr IP if exist
+ // get uesr IP if exists
let ip = '', url = '';
if (req !== undefined) {
url = req.originalUrl;
@@ -16,7 +16,7 @@ export const errorLogger = (title, error, ignoreMessage, req) => {
if (error.response) {
// errorMessage = error.response.data; // commented for clean console
errorMessage = ''
- type = "RES";// response error - server find error and tell to front like status 402
+ type = "RES";// response error - server finds error and returns a status like 402 to front
} else if (error.request) {
errorMessage = error.message;
type = "REQ"; // request error - like error 500 or request timeouted
diff --git a/src/setup/utility/fetching.js b/src/setup/utility/fetching.js
index 412adc7..a85ecfe 100644
--- a/src/setup/utility/fetching.js
+++ b/src/setup/utility/fetching.js
@@ -1,6 +1,6 @@
import axios from "axios";
-// extended verion of axios (contain cancel token)
+// extended verion of axios (contains cancel token)
export const fetching = function (options, thenHandler, catchHandler) {
const {token, cancel} = axios.CancelToken.source();
options.cancelToken = token;
@@ -13,4 +13,4 @@ export const fetching = function (options, thenHandler, catchHandler) {
//
request.cancel = cancel;
return request;
-}
\ No newline at end of file
+}
diff --git a/src/setup/utility/isErrorData.js b/src/setup/utility/isErrorData.js
index 492c9df..3a6f667 100644
--- a/src/setup/utility/isErrorData.js
+++ b/src/setup/utility/isErrorData.js
@@ -1,5 +1,5 @@
/**
- * check data type is error or not
+ * check data type if it is error or not
* compatible with convertErrorToResponse()
* see fetcher/clientFetcher and server/fetchProvider
*
diff --git a/src/setup/utility/isValidUser.js b/src/setup/utility/isValidUser.js
index 64ec3f0..ac99fdc 100644
--- a/src/setup/utility/isValidUser.js
+++ b/src/setup/utility/isValidUser.js
@@ -1,9 +1,9 @@
import {getStore} from "trim-redux";
/**
- * check user in the past logged-in or not and token is valid or not
+ * check if the user has logged-in before or not and token is valid or not
*
- * @param updateIsRequired {boolean} : if set it false then user is valid just when has token
+ * @param updateIsRequired {boolean} : if it is set to false then user is valid just when has token
* @returns {boolean}
*/
export const isValidUser = (updateIsRequired = true) => {
diff --git a/src/setup/utility/jumpScrollToTop.js b/src/setup/utility/jumpScrollToTop.js
index 6c613c5..20e465d 100644
--- a/src/setup/utility/jumpScrollToTop.js
+++ b/src/setup/utility/jumpScrollToTop.js
@@ -4,7 +4,7 @@ import {IS_BROWSER, IS_SERVER} from "../constant";
/**
- * for reset scroll and got to top of page when redirect
+ * for resetting the scroll and getting to the top of page when redirected
*/
if (IS_BROWSER)
window.jumpScrollToTop_offset = 0;
@@ -13,6 +13,6 @@ export const jumpScrollToTop = () => {
if (IS_SERVER)
return;
- // time out is for ensure new component script loaded
+ // time out is for making sure if the new component script has loaded
setTimeout(() => $('html,body').animate({scrollTop: window.jumpScrollToTop_offset}, 'fast'), 200);
-}
\ No newline at end of file
+}
diff --git a/src/setup/utility/responseValidation.js b/src/setup/utility/responseValidation.js
index c50aee4..1b1ce83 100644
--- a/src/setup/utility/responseValidation.js
+++ b/src/setup/utility/responseValidation.js
@@ -1,5 +1,5 @@
/**
- * check data contain valid data and status property
+ * check if data contains valid data and status property
* see fetcher/clientFetcher and server/fetchProvider
*
* @param response
@@ -9,7 +9,7 @@ export const responseValidation = function (response) {
if (typeof response === "undefined")
throw new Error("⛔ invalid fetch() response. response is undefined. response must be an object with 'status' and 'data' property.");
- // exist data and status
+ // data existence and status
if (!response.hasOwnProperty('data') || !response.hasOwnProperty('status'))
throw new Error('⛔ invalid fetch() response. check axios returns, "data" and "status" is required properties in response.');