feat(web): add types to dispatcher ()

* feat: add types to dispatcher

* fix: create album name

* pr feedback

* pr feedback

* pr feedback

* fix: api key name

* remove newSharedAlbum

* pr feedback

* fix: api key creation

* on:close

* fix: owner

* fix: onclose

* remove unused code

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
martin 2023-12-15 03:54:21 +01:00 committed by GitHub
parent 502495883d
commit 4c5397d7e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
41 changed files with 199 additions and 130 deletions
web/src/lib/components/user-settings-page

View file

@ -29,10 +29,9 @@
keys = data;
}
const handleCreate = async (event: CustomEvent<APIKeyResponseDto>) => {
const handleCreate = async (detail: Partial<APIKeyResponseDto>) => {
try {
const dto = event.detail;
const { data } = await api.keyApi.createApiKey({ aPIKeyCreateDto: dto });
const { data } = await api.keyApi.createApiKey({ aPIKeyCreateDto: detail });
secret = data.secret;
} catch (error) {
handleError(error, 'Unable to create a new API Key');
@ -42,15 +41,13 @@
}
};
const handleUpdate = async (event: CustomEvent<APIKeyResponseDto>) => {
if (!editKey) {
const handleUpdate = async (detail: Partial<APIKeyResponseDto>) => {
if (!editKey || !detail.name) {
return;
}
const dto = event.detail;
try {
await api.keyApi.updateApiKey({ id: editKey.id, aPIKeyUpdateDto: { name: dto.name } });
await api.keyApi.updateApiKey({ id: editKey.id, aPIKeyUpdateDto: { name: detail.name } });
notificationController.show({
message: `Saved API Key`,
type: NotificationType.Info,
@ -88,7 +85,7 @@
title="New API Key"
submitText="Create"
apiKey={newKey}
on:submit={handleCreate}
on:submit={({ detail }) => handleCreate(detail)}
on:cancel={() => (newKey = null)}
/>
{/if}
@ -98,7 +95,12 @@
{/if}
{#if editKey}
<APIKeyForm submitText="Save" apiKey={editKey} on:submit={handleUpdate} on:cancel={() => (editKey = null)} />
<APIKeyForm
submitText="Save"
apiKey={editKey}
on:submit={({ detail }) => handleUpdate(detail)}
on:cancel={() => (editKey = null)}
/>
{/if}
{#if deleteKey}