dce-reactkit 3.6.25 → 3.6.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +15 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/helpers/genRouteHandler.d.ts +7 -1
- package/dist/cjs/types/html/genInfoPage.d.ts +12 -0
- package/dist/esm/index.js +15 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/helpers/genRouteHandler.d.ts +7 -1
- package/dist/esm/types/html/genInfoPage.d.ts +12 -0
- package/dist/index.d.ts +7 -1
- package/package.json +1 -1
- package/src/helpers/genRouteHandler.ts +27 -1
- package/src/html/genInfoPage.ts +100 -0
package/dist/cjs/index.js
CHANGED
|
@@ -42187,10 +42187,12 @@ const parseUserAgent = (userAgent) => {
|
|
|
42187
42187
|
* send (a function that sends a string to the client),
|
|
42188
42188
|
* redirect (takes a url and redirects the user to that url),
|
|
42189
42189
|
* renderErrorPage (shows a static error page to the user),
|
|
42190
|
+
* renderInfoPage (shows a static info page to the user),
|
|
42190
42191
|
* and returns the value to send to the client as a JSON API response, or
|
|
42191
42192
|
* calls next() or redirect(...) or send(...) or renderErrorPage(...).
|
|
42192
42193
|
* Note: params also has userId, userFirstName,
|
|
42193
|
-
* userLastName, isLearner, isTTM, isAdmin,
|
|
42194
|
+
* userLastName, userEmail, userAvatarURL, isLearner, isTTM, isAdmin,
|
|
42195
|
+
* and any other variables that
|
|
42194
42196
|
* are directly added to the session, if the user does have a session.
|
|
42195
42197
|
*/
|
|
42196
42198
|
const genRouteHandler = (opts) => {
|
|
@@ -42686,6 +42688,17 @@ const genRouteHandler = (opts) => {
|
|
|
42686
42688
|
},
|
|
42687
42689
|
});
|
|
42688
42690
|
};
|
|
42691
|
+
/**
|
|
42692
|
+
* Render an info page
|
|
42693
|
+
* @author Gabe Abrams
|
|
42694
|
+
* @param renderOpts object containing all arguments
|
|
42695
|
+
* @param renderOpts.title title of the info box
|
|
42696
|
+
* @param renderOpts.body a human-readable text body for the info alert
|
|
42697
|
+
*/
|
|
42698
|
+
const renderInfoPage = (renderOpts) => {
|
|
42699
|
+
const html = genErrorPage(renderOpts);
|
|
42700
|
+
send(html, 200);
|
|
42701
|
+
};
|
|
42689
42702
|
// Call the handler
|
|
42690
42703
|
try {
|
|
42691
42704
|
const results = yield opts.handler({
|
|
@@ -42698,6 +42711,7 @@ const genRouteHandler = (opts) => {
|
|
|
42698
42711
|
},
|
|
42699
42712
|
redirect,
|
|
42700
42713
|
renderErrorPage,
|
|
42714
|
+
renderInfoPage,
|
|
42701
42715
|
logServerEvent,
|
|
42702
42716
|
});
|
|
42703
42717
|
// Send results to client (only if next wasn't called)
|