dce-reactkit 3.9.0 → 3.9.2

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.
@@ -3,6 +3,7 @@
3
3
  * dce-reactkit [for server only]
4
4
  * @author Gabe Abrams
5
5
  * @param opts object containing all arguments
6
+ * @param opts.host - the host of the other server
6
7
  * @param opts.path - the path of the other server's endpoint
7
8
  * @param [opts.method=GET] - the method of the endpoint
8
9
  * @param [opts.params] - query/body parameters to include
@@ -10,6 +11,7 @@
10
11
  * @returns response from server
11
12
  */
12
13
  declare const visitEndpointOnAnotherServer: (opts: {
14
+ host: string;
13
15
  path: string;
14
16
  method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
15
17
  params?: {
package/dist/index.d.ts CHANGED
@@ -1608,6 +1608,7 @@ declare const shuffleArray: <T>(arr: T[]) => T[];
1608
1608
  * dce-reactkit [for server only]
1609
1609
  * @author Gabe Abrams
1610
1610
  * @param opts object containing all arguments
1611
+ * @param opts.host - the host of the other server
1611
1612
  * @param opts.path - the path of the other server's endpoint
1612
1613
  * @param [opts.method=GET] - the method of the endpoint
1613
1614
  * @param [opts.params] - query/body parameters to include
@@ -1615,6 +1616,7 @@ declare const shuffleArray: <T>(arr: T[]) => T[];
1615
1616
  * @returns response from server
1616
1617
  */
1617
1618
  declare const visitEndpointOnAnotherServer: (opts: {
1619
+ host: string;
1618
1620
  path: string;
1619
1621
  method?: "GET" | "POST" | "DELETE" | "PUT" | undefined;
1620
1622
  params?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dce-reactkit",
3
- "version": "3.9.0",
3
+ "version": "3.9.2",
4
4
  "description": "Shared components for Harvard DCE apps",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -354,22 +354,22 @@ const genRouteHandler = (
354
354
  output.userId = (
355
355
  launchInfo
356
356
  ? launchInfo.userId
357
- : undefined
357
+ : (output.userId ?? undefined)
358
358
  );
359
359
  output.userFirstName = (
360
360
  launchInfo
361
361
  ? launchInfo.userFirstName
362
- : undefined
362
+ : (output.userFirstName ?? undefined)
363
363
  );
364
364
  output.userLastName = (
365
365
  launchInfo
366
366
  ? launchInfo.userLastName
367
- : undefined
367
+ : (output.userLastName ?? undefined)
368
368
  );
369
369
  output.userEmail = (
370
370
  launchInfo
371
371
  ? launchInfo.userEmail
372
- : undefined
372
+ : (output.userEmail ?? undefined)
373
373
  );
374
374
  output.userAvatarURL = (
375
375
  launchInfo
@@ -377,32 +377,32 @@ const genRouteHandler = (
377
377
  launchInfo.userImage
378
378
  ?? 'http://www.gravatar.com/avatar/?d=identicon'
379
379
  )
380
- : undefined
380
+ : (output.userAvatarURL ?? undefined)
381
381
  );
382
382
  output.isLearner = (
383
383
  launchInfo
384
384
  ? !!launchInfo.isLearner
385
- : undefined
385
+ : (output.isLearner ?? undefined)
386
386
  );
387
387
  output.isTTM = (
388
388
  launchInfo
389
389
  ? !!launchInfo.isTTM
390
- : undefined
390
+ : (output.isTTM ?? undefined)
391
391
  );
392
392
  output.isAdmin = (
393
393
  launchInfo
394
394
  ? !!launchInfo.isAdmin
395
- : undefined
395
+ : (output.isAdmin ?? undefined)
396
396
  );
397
397
  output.courseId = (
398
398
  launchInfo
399
399
  ? (output.courseId ?? launchInfo.courseId)
400
- : undefined
400
+ : (output.courseId ?? undefined)
401
401
  );
402
402
  output.courseName = (
403
403
  launchInfo
404
404
  ? launchInfo.contextLabel
405
- : undefined
405
+ : (output.courseName ?? undefined)
406
406
  );
407
407
 
408
408
  // Add other session variables
@@ -12,6 +12,7 @@ import sendServerToServerRequest from './sendServerToServerRequest';
12
12
  * dce-reactkit [for server only]
13
13
  * @author Gabe Abrams
14
14
  * @param opts object containing all arguments
15
+ * @param opts.host - the host of the other server
15
16
  * @param opts.path - the path of the other server's endpoint
16
17
  * @param [opts.method=GET] - the method of the endpoint
17
18
  * @param [opts.params] - query/body parameters to include
@@ -20,6 +21,7 @@ import sendServerToServerRequest from './sendServerToServerRequest';
20
21
  */
21
22
  const visitEndpointOnAnotherServer = async (
22
23
  opts: {
24
+ host: string,
23
25
  path: string,
24
26
  method?: ('GET' | 'POST' | 'DELETE' | 'PUT'),
25
27
  params?: { [key in string]: any },
@@ -54,6 +56,7 @@ const visitEndpointOnAnotherServer = async (
54
56
 
55
57
  // Send the request
56
58
  const response = await sendServerToServerRequest({
59
+ host: opts.host,
57
60
  path: opts.path,
58
61
  method: opts.method ?? 'GET',
59
62
  params,