mirror of
https://github.com/nikdoof/pocket-id.git
synced 2025-12-14 15:22:18 +00:00
fix: OIDC client logo gets removed if other properties get updated
This commit is contained in:
@@ -10,7 +10,7 @@ export type OidcClient = {
|
|||||||
export type OidcClientCreate = Omit<OidcClient, 'id' | 'logoURL' | 'hasLogo'>;
|
export type OidcClientCreate = Omit<OidcClient, 'id' | 'logoURL' | 'hasLogo'>;
|
||||||
|
|
||||||
export type OidcClientCreateWithLogo = OidcClientCreate & {
|
export type OidcClientCreateWithLogo = OidcClientCreate & {
|
||||||
logo: File | null;
|
logo: File | null | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type AuthorizeResponse = {
|
export type AuthorizeResponse = {
|
||||||
|
|||||||
@@ -33,7 +33,10 @@
|
|||||||
async function updateClient(updatedClient: OidcClientCreateWithLogo) {
|
async function updateClient(updatedClient: OidcClientCreateWithLogo) {
|
||||||
let success = true;
|
let success = true;
|
||||||
const dataPromise = oidcService.updateClient(client.id, updatedClient);
|
const dataPromise = oidcService.updateClient(client.id, updatedClient);
|
||||||
const imagePromise = oidcService.updateClientLogo(client, updatedClient.logo);
|
const imagePromise =
|
||||||
|
updatedClient.logo !== undefined
|
||||||
|
? oidcService.updateClientLogo(client, updatedClient.logo)
|
||||||
|
: Promise.resolve();
|
||||||
|
|
||||||
client.isPublic = updatedClient.isPublic;
|
client.isPublic = updatedClient.isPublic;
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
} = $props();
|
} = $props();
|
||||||
|
|
||||||
let isLoading = $state(false);
|
let isLoading = $state(false);
|
||||||
let logo = $state<File | null>(null);
|
let logo = $state<File | null | undefined>();
|
||||||
let logoDataURL: string | null = $state(
|
let logoDataURL: string | null = $state(
|
||||||
existingClient?.hasLogo ? `/api/oidc/clients/${existingClient!.id}/logo` : null
|
existingClient?.hasLogo ? `/api/oidc/clients/${existingClient!.id}/logo` : null
|
||||||
);
|
);
|
||||||
@@ -108,7 +108,7 @@
|
|||||||
onchange={onLogoChange}
|
onchange={onLogoChange}
|
||||||
>
|
>
|
||||||
<Button variant="secondary">
|
<Button variant="secondary">
|
||||||
{existingClient?.hasLogo ? 'Change Logo' : 'Upload Logo'}
|
{logoDataURL ? 'Change Logo' : 'Upload Logo'}
|
||||||
</Button>
|
</Button>
|
||||||
</FileInput>
|
</FileInput>
|
||||||
{#if logoDataURL}
|
{#if logoDataURL}
|
||||||
|
|||||||
Reference in New Issue
Block a user