Skip to content

Commit 4ebba24

Browse files
committed
fixes for inactive clickwraps showing
1 parent b5f5f55 commit 4ebba24

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

lib/click/controllers/eg006EmbedClickwrap.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
*/
66

77
const path = require("path");
8-
const { embedClickwrap } = require("../examples/embedClickwrap");
8+
const { embedClickwrap, getActiveClickwraps } = require("../examples/embedClickwrap");
99
const validator = require("validator");
10-
const { getClickwraps } = require("../examples/listClickwraps");
1110
const { getExampleByNumber } = require("../../manifestService");
1211
const dsConfig = require("../../../config/index.js").config;
1312

@@ -67,7 +66,7 @@
6766
const errorMessage = errorBody && errorBody.message;
6867
// In production, you may want to provide customized error messages and
6968
// remediation advice to the user
70-
res.render("pages/error_eg006", { err: error, errorCode, errorMessage });
69+
res.render("pages/error", { err: error, errorCode, errorMessage });
7170
}
7271
if (results) {
7372
// Save for use by other examples that need an clickwrapId
@@ -109,7 +108,7 @@
109108
eg: eg, csrfToken: req.csrfToken(),
110109
example: example,
111110
sourceFile: sourceFile,
112-
clickwrapsData: await getClickwraps(args),
111+
clickwrapsData: await getActiveClickwraps(args),
113112
sourceUrl: dsConfig.githubExampleUrl + 'click/examples/' + sourceFile,
114113
documentation: dsConfig.documentation + eg,
115114
showDoc: dsConfig.documentation

lib/click/examples/embedClickwrap.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,20 @@
5353
});
5454
console.log(`See the embedded clickwrap on this page:`);
5555
return result;
56+
5657
};
5758

58-
module.exports = { embedClickwrap };
59+
const getActiveClickwraps = async (args) => {
60+
// Call the Click API
61+
// Create Click API client
62+
const dsApiClient = new docusignClick.ApiClient();
63+
dsApiClient.setBasePath(args.basePath)
64+
dsApiClient.addDefaultHeader("Authorization", "Bearer " + args.accessToken);
65+
const accountApi = new docusignClick.AccountsApi(dsApiClient);
66+
67+
// Get a list of inactive clickwraps
68+
return await accountApi.getClickwraps(args.accountId, {status: 'active'});
69+
}
70+
71+
module.exports = { getActiveClickwraps, embedClickwrap };
5972

0 commit comments

Comments
 (0)