1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix(web) display wrong apikey-name on edit (#7131)

* fix display wrong apikey-name on edit

* use apiKey property with fallback value

* remove null fallback

* chore: cleanup

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Jan 2024-02-16 22:01:44 +01:00 committed by GitHub
parent c84c0bae6c
commit 67b1675850
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,7 +11,6 @@
export let title = 'API Key'; export let title = 'API Key';
export let cancelText = 'Cancel'; export let cancelText = 'Cancel';
export let submitText = 'Save'; export let submitText = 'Save';
export let apiKeyName = 'API Key';
const dispatch = createEventDispatcher<{ const dispatch = createEventDispatcher<{
cancel: void; cancel: void;
@ -19,8 +18,8 @@
}>(); }>();
const handleCancel = () => dispatch('cancel'); const handleCancel = () => dispatch('cancel');
const handleSubmit = () => { const handleSubmit = () => {
if (apiKeyName) { if (apiKey.name) {
dispatch('submit', { ...apiKey, name: apiKeyName }); dispatch('submit', apiKey);
} else { } else {
notificationController.show({ notificationController.show({
message: "Your API Key name shouldn't be empty", message: "Your API Key name shouldn't be empty",
@ -46,7 +45,7 @@
<form on:submit|preventDefault={handleSubmit} autocomplete="off"> <form on:submit|preventDefault={handleSubmit} autocomplete="off">
<div class="m-4 flex flex-col gap-2"> <div class="m-4 flex flex-col gap-2">
<label class="immich-form-label" for="name">Name</label> <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>
<div class="mt-8 flex w-full gap-4 px-4"> <div class="mt-8 flex w-full gap-4 px-4">