2023-05-28 23:13:24 +02:00
|
|
|
<script setup lang="ts">
|
|
|
|
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>
|
|
|
|
|
2022-07-25 18:37:14 +02:00
|
|
|
<template>
|
|
|
|
<div>
|
2023-05-14 21:26:18 +02:00
|
|
|
<c-input-text v-model:value="username" label="Username" placeholder="Your username..." clearable raw-text mb-5 />
|
|
|
|
<c-input-text
|
|
|
|
v-model:value="password"
|
|
|
|
label="Password"
|
|
|
|
placeholder="Your password..."
|
|
|
|
clearable
|
|
|
|
raw-text
|
|
|
|
mb-2
|
|
|
|
type="password"
|
|
|
|
/>
|
2022-07-25 18:37:14 +02:00
|
|
|
|
2023-04-20 20:49:28 +02:00
|
|
|
<c-card>
|
2022-07-25 18:37:14 +02:00
|
|
|
<n-statistic label="Authorization header:" class="header">
|
|
|
|
<n-scrollbar x-scrollable style="max-width: 550px; margin-bottom: -10px; padding-bottom: 10px" trigger="none">
|
|
|
|
{{ header }}
|
|
|
|
</n-scrollbar>
|
|
|
|
</n-statistic>
|
2023-04-20 20:49:28 +02:00
|
|
|
</c-card>
|
2023-05-27 17:36:15 +02:00
|
|
|
<div mt-5 flex justify-center>
|
2023-05-28 23:13:24 +02:00
|
|
|
<c-button @click="copy">
|
|
|
|
Copy header
|
|
|
|
</c-button>
|
2023-05-27 17:36:15 +02:00
|
|
|
</div>
|
2022-07-25 18:37:14 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
::v-deep(.n-statistic-value__content) {
|
|
|
|
font-family: monospace;
|
|
|
|
font-size: 17px !important;
|
|
|
|
white-space: nowrap;
|
|
|
|
}
|
|
|
|
</style>
|