From 0485c224b0983da96912616c7143e8704c873725 Mon Sep 17 00:00:00 2001 From: Markus Thielker Date: Sun, 29 Dec 2024 00:33:09 +0100 Subject: [PATCH] NORY-47: add action for updating an identity --- dashboard/src/app/(inside)/user/action.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/dashboard/src/app/(inside)/user/action.ts b/dashboard/src/app/(inside)/user/action.ts index 4c393cc..bd2ffbd 100644 --- a/dashboard/src/app/(inside)/user/action.ts +++ b/dashboard/src/app/(inside)/user/action.ts @@ -2,11 +2,28 @@ import { getIdentityApi } from '@/ory/sdk/server'; import { revalidatePath } from 'next/cache'; +import { UpdateIdentityBody } from '@ory/client/api'; interface IdentityIdProps { id: string; } +interface UpdatedIdentityProps { + id: string; + body: UpdateIdentityBody; +} + +export async function updateIdentity({ id, body }: UpdatedIdentityProps) { + + const identityApi = await getIdentityApi(); + const { data } = await identityApi.updateIdentity({ + id: id, + updateIdentityBody: body, + }); + + return data; +} + export async function deleteIdentitySessions({ id }: IdentityIdProps) { const identityApi = await getIdentityApi();