Skip to content

Commit

Permalink
fix(web) display wrong apikey-name on edit (#7131)
Browse files Browse the repository at this point in the history
* fix display wrong apikey-name on edit

* use apiKey property with fallback value

* remove null fallback

* chore: cleanup

---------

Co-authored-by: Jason Rasmussen <[email protected]>
  • Loading branch information
JW-CH and jrasm91 authored Feb 16, 2024
1 parent c84c0ba commit 67b1675
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions web/src/lib/components/forms/api-key-form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
export let title = 'API Key';
export let cancelText = 'Cancel';
export let submitText = 'Save';
export let apiKeyName = 'API Key';
const dispatch = createEventDispatcher<{
cancel: void;
submit: Partial<ApiKeyResponseDto>;
}>();
const handleCancel = () => dispatch('cancel');
const handleSubmit = () => {
if (apiKeyName) {
dispatch('submit', { ...apiKey, name: apiKeyName });
if (apiKey.name) {
dispatch('submit', apiKey);
} else {
notificationController.show({
message: "Your API Key name shouldn't be empty",
Expand All @@ -46,7 +45,7 @@
<form on:submit|preventDefault={handleSubmit} autocomplete="off">
<div class="m-4 flex flex-col gap-2">
<label class="immich-form-label" for="name">Name</label>
<input class="immich-form-input" id="name" name="name" type="text" bind:value={apiKeyName} />
<input class="immich-form-input" id="name" name="name" type="text" bind:value={apiKey.name} />
</div>

<div class="mt-8 flex w-full gap-4 px-4">
Expand Down

0 comments on commit 67b1675

Please sign in to comment.