mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-26 13:48:33 +02:00
fix: using copy library for copying user token (#454)
* using copy library for copying user token * add "copy-to-clipboard" to dev dependencies Co-authored-by: Ivar Conradi Østhus <ivarconr@gmail.com>
This commit is contained in:
parent
0ddd52a8ba
commit
7602327991
@ -53,6 +53,7 @@
|
||||
"@welldone-software/why-did-you-render": "6.2.1",
|
||||
"array-move": "3.0.1",
|
||||
"classnames": "2.3.1",
|
||||
"copy-to-clipboard": "^3.3.1",
|
||||
"craco": "0.0.3",
|
||||
"css-loader": "6.4.0",
|
||||
"cypress": "8.6.0",
|
||||
|
@ -33,6 +33,7 @@ import ApiTokenCreate from '../ApiTokenCreate/ApiTokenCreate';
|
||||
import Dialogue from '../../common/Dialogue';
|
||||
import { CREATE_API_TOKEN_BUTTON } from '../../../testIds';
|
||||
import { Alert } from '@material-ui/lab';
|
||||
import copy from 'copy-to-clipboard';
|
||||
|
||||
interface IApiToken {
|
||||
createdAt: Date;
|
||||
@ -88,12 +89,13 @@ const ApiTokenList = ({ location }: IApiTokenList) => {
|
||||
});
|
||||
};
|
||||
const copyToken = (value: string) => {
|
||||
navigator.clipboard.writeText(value);
|
||||
setToastData({
|
||||
type: 'success',
|
||||
show: true,
|
||||
text: `Token is copied to clipboard`,
|
||||
});
|
||||
if (copy(value)) {
|
||||
setToastData({
|
||||
type: 'success',
|
||||
show: true,
|
||||
text: `Token is copied to clipboard`,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const onDeleteToken = async () => {
|
||||
|
@ -4144,6 +4144,13 @@ copy-descriptor@^0.1.0:
|
||||
resolved "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz"
|
||||
integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=
|
||||
|
||||
copy-to-clipboard@^3.3.1:
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae"
|
||||
integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw==
|
||||
dependencies:
|
||||
toggle-selection "^1.0.6"
|
||||
|
||||
core-js-compat@^3.6.2, core-js-compat@^3.8.1, core-js-compat@^3.9.0:
|
||||
version "3.10.0"
|
||||
resolved "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.10.0.tgz"
|
||||
@ -12272,6 +12279,11 @@ to-regex@^3.0.1, to-regex@^3.0.2:
|
||||
regex-not "^1.0.2"
|
||||
safe-regex "^1.1.0"
|
||||
|
||||
toggle-selection@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
|
||||
integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI=
|
||||
|
||||
toidentifier@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.0.tgz"
|
||||
|
Loading…
Reference in New Issue
Block a user