mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 15:26:15 -04:00
feat(rsa-key-pair-generator): refresh certs button
This commit is contained in:
parent
161a21f285
commit
165dc93f83
2 changed files with 47 additions and 3 deletions
|
@ -2,8 +2,10 @@
|
|||
<div style="flex: 0 0 100%">
|
||||
<n-space item-style="flex: 1 1 0" style="margin: 0 auto; max-width: 600px" justify="center">
|
||||
<n-form-item label="Bits :" v-bind="bitsValidationAttrs" label-placement="left" label-width="100">
|
||||
<n-input-number v-model:value="bits" min="256" max="16384" step="8" style="width: 150px" />
|
||||
<n-input-number v-model:value="bits" min="256" max="16384" step="8" />
|
||||
</n-form-item>
|
||||
|
||||
<n-button tertiary @click="refreshCerts">Refresh key-pair</n-button>
|
||||
</n-space>
|
||||
</div>
|
||||
|
||||
|
@ -21,9 +23,9 @@
|
|||
<script setup lang="ts">
|
||||
import TextareaCopyable from '@/components/TextareaCopyable.vue';
|
||||
import { ref } from 'vue';
|
||||
import { computedAsync } from '@vueuse/core';
|
||||
import { withDefaultOnErrorAsync } from '@/utils/defaults';
|
||||
import { useValidation } from '@/composable/validation';
|
||||
import { computedRefreshableAsync } from '@/composable/computedRefreshable';
|
||||
import { generateKeyPair } from './rsa-key-pair-generator.service';
|
||||
|
||||
const bits = ref(2048);
|
||||
|
@ -39,7 +41,7 @@ const { attrs: bitsValidationAttrs } = useValidation({
|
|||
],
|
||||
});
|
||||
|
||||
const certs = computedAsync(
|
||||
const [certs, refreshCerts] = computedRefreshableAsync(
|
||||
() => withDefaultOnErrorAsync(() => generateKeyPair({ bits: bits.value }), emptyCerts),
|
||||
emptyCerts,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue