refactor(base64): mutualized base64 functions into global utilities

This commit is contained in:
Corentin Thomasset 2022-08-04 12:09:32 +02:00
parent ca7cb44389
commit 447bdf2148
No known key found for this signature in database
GPG key ID: 3103EB5E79496F9C
8 changed files with 138 additions and 12 deletions

View file

@ -30,11 +30,12 @@
<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 ${window.btoa(`${username.value}:${password.value}`)}`);
const header = computed(() => `Authorization: Basic ${textToBase64(`${username.value}:${password.value}`)}`);
const { copy } = useCopy({ source: header, text: 'Header copied to the clipboard' });
</script>