1
0
Fork 0

Add copy token button, closes #9.

This commit is contained in:
Kitteh 2021-04-18 10:56:23 +01:00
parent 2c223dc1aa
commit 5be2bf0779

View file

@ -4,7 +4,7 @@ import { getAPIURL, getToken } from "../utils.js";
import { makeElement } from "../htmlUtils.js"; import { makeElement } from "../htmlUtils.js";
import { getSealStatus, lookupSelf, getMounts, renewSelf } from "../api.js"; import { getSealStatus, lookupSelf, getMounts, renewSelf } from "../api.js";
import formatDistance from 'date-fns/formatDistance'; import formatDistance from 'date-fns/formatDistance';
import ClipboardJS from "clipboard";
export class HomePage extends Page { export class HomePage extends Page {
constructor() { constructor() {
@ -50,6 +50,19 @@ export class HomePage extends Page {
} }
}) })
}), }),
makeElement({
tag: "li",
children: makeElement({
tag: "a",
text: "Copy Token",
attributes: {
"data-clipboard-text": getToken(),
},
thenRun: (e) => {
new ClipboardJS(e);
}
})
}),
makeElement({ makeElement({
tag: "li", tag: "li",
children: makeElement({ children: makeElement({