mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-23 09:30:30 +02:00
23 lines
560 B
TypeScript
23 lines
560 B
TypeScript
import {Language, ServerUser} 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<ServerUser> {
|
|
const {data: user} = await client.patch(
|
|
`${import.meta.env.VITE_SERVER_BASE_URL}/v1/account`,
|
|
updateData,
|
|
{
|
|
withCredentials: true,
|
|
},
|
|
)
|
|
|
|
return parseUser(user)
|
|
}
|