Skip to content

Commit

Permalink
fix creation flow
Browse files Browse the repository at this point in the history
  • Loading branch information
zlayine committed Oct 3, 2024
1 parent febe75a commit 1154fc1
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions resources/js/components/pages/SettingsWalletDaemon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,13 @@
<div class="text-sm">
<span> API Token was successfully created. Token: </span>
<CopyTextIcon
v-if="tokens[0].plainTextToken"
v-if="creationFlowToken"
ref="copyIconRef"
class="cursor-pointer inline-flex"
:text="
tokens[0].plainTextToken.substring(
tokens[0].plainTextToken?.indexOf('|') + 1 ?? 0
)
"
:text="creationFlowToken.substring(creationFlowToken?.indexOf('|') + 1 ?? 0)"
>
<span class="truncate text-light-content-brand dark:text-dark-content-brand">
{{
tokens[0].plainTextToken?.substring(
tokens[0].plainTextToken?.indexOf('|') + 1 ?? 0
)
}}
{{ creationFlowToken?.substring(creationFlowToken?.indexOf('|') + 1 ?? 0) }}
</span>
</CopyTextIcon>
</div>
Expand Down Expand Up @@ -111,7 +103,7 @@
To configure a new Daemon wallet, you'll need to create an API token. This token
will be used to authenticate your Daemon wallet with your Platform account.
</p>
<div v-if="tokens.length">
<div v-if="tokens.length" class="flex flex-col">
<span class="text-xl mb-4">My API Tokens</span>
<div class="grid grid-cols-1 gap-4">
<div
Expand Down Expand Up @@ -227,6 +219,7 @@ const confirmModal = ref(false);
const confirmModalName = ref();
const creationFlow = ref(false);
const loadingUser = ref(false);
const creationFlowToken = ref('');
const tokens = computed(() => appStore.user?.apiTokens ?? []);
Expand Down Expand Up @@ -270,6 +263,10 @@ const createApiToken = async () => {
enableTokenCreate.value = false;
tokenName.value = '';
snackbar.info({ title: 'Token generated', text: `Your token ${tokenName.value} has been generated.` });
if (tokens.value.length === 1) {
creationFlowToken.value = tokens.value[0].plainTextToken;
creationFlow.value = true;
}
} catch (e: any) {
if (snackbarErrors(e)) return;
snackbar.error({ title: 'Token generation failed', text: e.message });
Expand Down

0 comments on commit 1154fc1

Please sign in to comment.