Eduzz Apps Toolbar
Toolbar cross-application
How to use
In Browser
(function (d, l, c) {
var s = d.createElement('script');
s.async = true;
s.src = l;
s.onload = c;
d.body.append(s);
})(document, 'https://unpkg.com/@eduzz/apps-toolbar@^1.4.1/build/widget.js', function () {
var toolbar = window.EduzzAppsToolbar({
application: 'nutror',
accessKey: '123',
eduzzUserId: 1,
eduzzUserEmail: 'daniel.prado@eduzz.com'
});
toolbar.setUser('accessKey',1, 'daniel.prado@eduzz.com');
toolbar.setUser(null);
});
Via npm
import EduzzAppsToolbar from '@eduzz/apps-toolbar';
import { IUser } from 'interfaces/models/user';
const promiseToolbar = EduzzAppsToolbar({
application: 'nutror'
});
export async function setUser(user: IUser) {
const toolbar = await promiseToolbar;
if (!toolbar) return;
toolbar.setUser(user.hash, user.clicodeduzz, user.email);
}
export async function clearUser() {
const toolbar = await promiseToolbar;
if (!toolbar) return;
toolbar.setUser(null);
}