diff options
Diffstat (limited to 'src/tools/basic-auth-generator/basic-auth-generator.vue')
-rw-r--r-- | src/tools/basic-auth-generator/basic-auth-generator.vue | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/tools/basic-auth-generator/basic-auth-generator.vue b/src/tools/basic-auth-generator/basic-auth-generator.vue index 7e0660b..acca61f 100644 --- a/src/tools/basic-auth-generator/basic-auth-generator.vue +++ b/src/tools/basic-auth-generator/basic-auth-generator.vue @@ -1,3 +1,15 @@ +<script setup lang="ts"> +import { computed, ref } from 'vue'; +import { useCopy } from '@/composable/copy'; +import { textToBase64 } from '@/utils/base64'; + +const username = ref(''); +const password = ref(''); +const header = computed(() => `Authorization: Basic ${textToBase64(`${username.value}:${password.value}`)}`); + +const { copy } = useCopy({ source: header, text: 'Header copied to the clipboard' }); +</script> + <template> <div> <c-input-text v-model:value="username" label="Username" placeholder="Your username..." clearable raw-text mb-5 /> @@ -19,23 +31,13 @@ </n-statistic> </c-card> <div mt-5 flex justify-center> - <c-button @click="copy">Copy header</c-button> + <c-button @click="copy"> + Copy header + </c-button> </div> </div> </template> -<script setup lang="ts"> -import { useCopy } from '@/composable/copy'; -import { textToBase64 } from '@/utils/base64'; -import { computed, ref } from 'vue'; - -const username = ref(''); -const password = ref(''); -const header = computed(() => `Authorization: Basic ${textToBase64(`${username.value}:${password.value}`)}`); - -const { copy } = useCopy({ source: header, text: 'Header copied to the clipboard' }); -</script> - <style lang="less" scoped> ::v-deep(.n-statistic-value__content) { font-family: monospace; |