fix(otp-generator): editable secret

This commit is contained in:
Corentin Thomasset 2023-04-04 12:55:02 +02:00
parent b3390f6ff7
commit a599528044
No known key found for this signature in database
GPG key ID: DBD997E935996158

View file

@ -63,9 +63,9 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, ref, watch } from 'vue'; import { computed, ref } from 'vue';
import { Refresh } from '@vicons/tabler'; import { Refresh } from '@vicons/tabler';
import { useTimestamp, useWindowFocus, whenever } from '@vueuse/core'; import { useTimestamp } from '@vueuse/core';
import { useThemeVars } from 'naive-ui'; import { useThemeVars } from 'naive-ui';
import { useStyleStore } from '@/stores/style.store'; import { useStyleStore } from '@/stores/style.store';
import InputCopyable from '@/components/InputCopyable.vue'; import InputCopyable from '@/components/InputCopyable.vue';
@ -80,7 +80,11 @@ const interval = computed(() => (now.value / 1000) % 30);
const theme = useThemeVars(); const theme = useThemeVars();
const styleStore = useStyleStore(); const styleStore = useStyleStore();
const [secret, refreshSecret] = computedRefreshable(generateSecret); const secret = ref(generateSecret());
function refreshSecret() {
secret.value = generateSecret();
}
const [tokens] = computedRefreshable( const [tokens] = computedRefreshable(
() => ({ () => ({