Skip to content

Commit 2657888

Browse files
committed
add snippet names
1 parent 0e05c9b commit 2657888

File tree

1 file changed

+8
-0
lines changed
  • dataverse/webapi/JS/SPASample/src/scripts

1 file changed

+8
-0
lines changed

dataverse/webapi/JS/SPASample/src/scripts/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const container = document.getElementById("container");
4242

4343
const util = new Util(container);
4444

45+
// <logIn>
4546
// Event handler for login button
4647
async function logIn() {
4748
await msalInstance.initialize();
@@ -72,7 +73,9 @@ async function logIn() {
7273
this.click();
7374
}
7475
}
76+
// </logIn>
7577

78+
// <logOut>
7679
// Event handler for logout button
7780
async function logOut() {
7881
const activeAccount = await msalInstance.getActiveAccount();
@@ -96,7 +99,9 @@ async function logOut() {
9699
// Clear the client instance
97100
client = null;
98101
}
102+
// </logOut>
99103

104+
// <getToken>
100105
/**
101106
* Retrieves an access token using MSAL (Microsoft Authentication Library).
102107
* Set as the getToken function for the DataverseWebAPI client in the login function.
@@ -124,7 +129,9 @@ async function getToken() {
124129
}
125130
}
126131
}
132+
// </getToken>
127133

134+
// <runSample>
128135
// Runs all samples in a consistent way
129136
async function runSample(sample) {
130137
// Disable the buttons to prevent multiple clicks
@@ -142,6 +149,7 @@ async function runSample(sample) {
142149
document.getElementsByTagName("nav")[0].classList.remove("disabled");
143150
logoutButton.classList.remove("disabled");
144151
}
152+
// </runSample>
145153

146154
//#region verify that configuration has been updated.
147155

0 commit comments

Comments
 (0)