fix: copy token

This commit is contained in:
Muhsin Keloth
2024-04-24 16:09:44 +05:30
parent a76ce6a0f3
commit 5885342325
2 changed files with 13 additions and 5 deletions
@@ -25,7 +25,6 @@
<script setup>
import FormInput from 'v3/components/Form/Input.vue';
import FormButton from 'v3/components/Form/Button.vue';
import { copyTextToClipboard } from 'shared/helpers/clipboard';
const props = defineProps({
value: {
@@ -34,8 +33,9 @@ const props = defineProps({
},
});
const onClick = async e => {
e.preventDefault();
await copyTextToClipboard(props.value);
const emit = defineEmits(['on-copy']);
const onClick = () => {
emit('on-copy', props.value);
};
</script>
@@ -94,7 +94,10 @@
:show-action-button="false"
>
<template #settingsItem>
<access-token :value="currentUser.access_token" />
<access-token
:value="currentUser.access_token"
@on-copy="onCopyToken"
/>
</template>
</profile-wrapper>
</div>
@@ -103,6 +106,7 @@
</template>
<script>
import globalConfigMixin from 'shared/mixins/globalConfigMixin';
import { copyTextToClipboard } from 'shared/helpers/clipboard';
import uiSettingsMixin, {
isEditorHotKeyEnabled,
} from 'dashboard/mixins/uiSettings';
@@ -243,6 +247,10 @@ export default {
this.$t('PROFILE_SETTINGS.FORM.SEND_MESSAGE.UPDATE_SUCCESS')
);
},
async onCopyToken(value) {
await copyTextToClipboard(value);
this.showAlert(this.$t('COMPONENTS.CODE.COPY_SUCCESSFUL'));
},
},
};
</script>