Skip to content

Commit 330ee4d

Browse files
committed
added ui for setting tenant-id
1 parent 2857f04 commit 330ee4d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/auth/demo/public/index.html

+12
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,18 @@
229229
</button>
230230
</form>
231231

232+
<!-- Set Tenant -->
233+
<div class="group">Set Tenant</div>
234+
<form class="form form-bordered no-submit">
235+
<input type="text" id="set-tenant"
236+
class="form-control"
237+
placeholder="Tenant" />
238+
<button class="btn btn-block btn-primary"
239+
id="set-tenant-btn">
240+
Set Tenant
241+
</button>
242+
</form>
243+
232244
<!-- Sign up -->
233245
<div class="group">Sign Up</div>
234246
<form class="form form-bordered no-submit">

packages/auth/demo/src/index.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,15 @@ function onUseDeviceLanguage() {
314314
$('#language-code').val(auth.languageCode);
315315
alertSuccess('Using device language "' + auth.languageCode + '".');
316316
}
317-
317+
/**
318+
* Set tenant id for the firebase project.
319+
*/
320+
function onSetTenantIdClick(_event) {
321+
console.log('onSetTenant called');
322+
const tenantId = $('#set-tenant').val();
323+
auth.tenantId = tenantId === '' ? null : tenantId;
324+
alertSuccess('Tenant Id : ' + auth.tenantId);
325+
}
318326
/**
319327
* Changes the Auth state persistence to the specified one.
320328
*/
@@ -2032,6 +2040,8 @@ function initApp() {
20322040
$('#enroll-mfa-totp-start').click(onStartEnrollWithTotpMultiFactor);
20332041
// Completes multi-factor enrollment with supplied OTP(One-Time Password).
20342042
$('#enroll-mfa-totp-finalize').click(onFinalizeEnrollWithTotpMultiFactor);
2043+
// Sets tenant for the current auth instance
2044+
$('#set-tenant-btn').click(onSetTenantIdClick);
20352045
}
20362046

20372047
$(initApp);

0 commit comments

Comments
 (0)