1
0
Fork 0
mirror of https://codeberg.org/MarkusThielker/next-ory.git synced 2025-04-10 11:58:41 +00:00

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 { getIdentityApi } from '@/ory/sdk/server';
import { revalidatePath } from 'next/cache'; import { revalidatePath } from 'next/cache';
import { UpdateIdentityBody } from '@ory/client/api'; import { DeleteIdentityCredentialsTypeEnum, UpdateIdentityBody } from '@ory/client';
interface UpdatedIdentityProps { interface UpdatedIdentityProps {
id: string; id: string;
@ -17,6 +17,23 @@ export async function updateIdentity({ id, body }: UpdatedIdentityProps) {
updateIdentityBody: body, 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; return data;
} }