NORY-47: add action to delete identity credential

This commit is contained in:
Markus Thielker 2025-01-03 22:01:40 +01:00
parent 88115d143e
commit e83041f8ac
No known key found for this signature in database

View file

@ -2,7 +2,7 @@
import { getIdentityApi } from '@/ory/sdk/server';
import { revalidatePath } from 'next/cache';
import { UpdateIdentityBody } from '@ory/client/api';
import { DeleteIdentityCredentialsTypeEnum, UpdateIdentityBody } from '@ory/client';
interface UpdatedIdentityProps {
id: string;
@ -17,6 +17,23 @@ export async function updateIdentity({ id, body }: UpdatedIdentityProps) {
updateIdentityBody: body,
});
console.log('Updated identity', data);
return data;
}
interface DeleteIdentityCredentialProps {
id: string;
type: DeleteIdentityCredentialsTypeEnum;
}
export async function deleteIdentityCredential({ id, type }: DeleteIdentityCredentialProps) {
const identityApi = await getIdentityApi();
const { data } = await identityApi.deleteIdentityCredentials({ id, type });
console.log('Credential removed', data);
return data;
}