mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-20 00:05:26 +02:00
28 lines
607 B
TypeScript
28 lines
607 B
TypeScript
import {AuthenticationDetails, Language} from "~/server-types"
|
|
import {client} from "~/constants/axios-client"
|
|
import parseUser from "~/apis/helpers/parse-user"
|
|
|
|
export interface UpdateAccountData {
|
|
encryptedPassword?: string
|
|
encryptedNotes?: string
|
|
publicKey?: string
|
|
language?: Language
|
|
}
|
|
|
|
export default async function updateAccount(
|
|
updateData: UpdateAccountData,
|
|
): Promise<AuthenticationDetails> {
|
|
const {data} = await client.patch(
|
|
`${import.meta.env.VITE_SERVER_BASE_URL}/account`,
|
|
updateData,
|
|
{
|
|
withCredentials: true,
|
|
},
|
|
)
|
|
|
|
return {
|
|
...data,
|
|
user: parseUser(data.user),
|
|
}
|
|
}
|