Compare commits

..

No commits in common. "02cd490700df7eff8c2ad40a6a46c3150ed1ac63" and "03b1d761f07fd47fefba610e88ce1462d1ac82b8" have entirely different histories.

2 changed files with 6 additions and 7 deletions

View File

@ -1,4 +1,4 @@
import type {AuthProvider, UpdatePasswordFormTypes} from "@refinedev/core"
import type {AuthProvider} from "@refinedev/core"
import type {
AuthActionResponse,
@ -31,8 +31,9 @@ export type Identity = {
email: string;
}
export interface UpdatePasswordFormRequest extends UpdatePasswordFormTypes{
export type UpdatePasswordFormRequest = {
currentPassword: string;
newPassword: string;
}
export const createPortalAuthProvider = (sdk: Sdk): AuthProvider => {
@ -101,7 +102,7 @@ export const createPortalAuthProvider = (sdk: Sdk): AuthProvider => {
async updatePassword(params: UpdatePasswordFormRequest): Promise<AuthActionResponse> {
maybeSetupAuth();
const ret = await sdk.account().updatePassword(params.currentPassword, params.password as string);
const ret = await sdk.account().updatePassword(params.currentPassword, params.newPassword);
if (ret) {
if (ret instanceof Error) {

View File

@ -29,7 +29,6 @@ import { Input } from "~/components/ui/input";
import { UsageCard } from "~/components/usage-card";
import QRImg from "~/images/QR.png";
import {UpdatePasswordFormRequest} from "~/data/auth-provider.js";
export default function MyAccount() {
const { data: identity } = useGetIdentity<{ email: string }>();
@ -293,7 +292,7 @@ const ChangePasswordForm = ({
open: boolean;
setOpen: (value: boolean) => void;
}) => {
const { mutate: updatePassword } = useUpdatePassword<UpdatePasswordFormRequest>();
const { mutate: updatePassword } = useUpdatePassword<{ password: string }>();
const [form, fields] = useForm({
id: "login",
constraint: getZodConstraint(ChangePasswordSchema),
@ -307,8 +306,7 @@ const ChangePasswordForm = ({
const data = Object.fromEntries(new FormData(e.currentTarget).entries());
updatePassword({
currentPassword: data.currentPassword.toString(),
password: data.newPassword.toString(),
password: data.newPassword.toString(),
});
},
});