Fix types
This commit is contained in:
parent
a6f425ef39
commit
0bd2d52840
3 changed files with 49 additions and 6 deletions
|
@ -22,7 +22,7 @@ interface StaffPasswordResetDialogFormData {
|
||||||
export interface StaffPasswordResetDialogProps extends DialogProps {
|
export interface StaffPasswordResetDialogProps extends DialogProps {
|
||||||
confirmButtonState: ConfirmButtonTransitionState;
|
confirmButtonState: ConfirmButtonTransitionState;
|
||||||
errors: UserError[];
|
errors: UserError[];
|
||||||
onSubmit: (password: string) => void;
|
onSubmit: (data: StaffPasswordResetDialogFormData) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
const initialForm: StaffPasswordResetDialogFormData = {
|
const initialForm: StaffPasswordResetDialogFormData = {
|
||||||
|
@ -47,11 +47,7 @@ const StaffPasswordResetDialog: React.FC<StaffPasswordResetDialogProps> = ({
|
||||||
description="dialog header"
|
description="dialog header"
|
||||||
/>
|
/>
|
||||||
</DialogTitle>
|
</DialogTitle>
|
||||||
<Form
|
<Form errors={apiErrors} initial={initialForm} onSubmit={onSubmit}>
|
||||||
errors={apiErrors}
|
|
||||||
initial={initialForm}
|
|
||||||
onSubmit={data => onSubmit(data.password)}
|
|
||||||
>
|
|
||||||
{({ change, data, errors, submit }) => (
|
{({ change, data, errors, submit }) => (
|
||||||
<>
|
<>
|
||||||
<DialogContent>
|
<DialogContent>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import gql from "graphql-tag";
|
import gql from "graphql-tag";
|
||||||
|
|
||||||
|
import makeMutation from "@saleor/hooks/makeMutation";
|
||||||
import { TypedMutation } from "../mutations";
|
import { TypedMutation } from "../mutations";
|
||||||
import { staffMemberDetailsFragment } from "./queries";
|
import { staffMemberDetailsFragment } from "./queries";
|
||||||
import { StaffAvatarDelete } from "./types/StaffAvatarDelete";
|
import { StaffAvatarDelete } from "./types/StaffAvatarDelete";
|
||||||
|
@ -19,6 +20,10 @@ import {
|
||||||
StaffMemberUpdate,
|
StaffMemberUpdate,
|
||||||
StaffMemberUpdateVariables
|
StaffMemberUpdateVariables
|
||||||
} from "./types/StaffMemberUpdate";
|
} from "./types/StaffMemberUpdate";
|
||||||
|
import {
|
||||||
|
ChangeStaffPassword,
|
||||||
|
ChangeStaffPasswordVariables
|
||||||
|
} from "./types/ChangeStaffPassword";
|
||||||
|
|
||||||
const staffMemberAddMutation = gql`
|
const staffMemberAddMutation = gql`
|
||||||
${staffMemberDetailsFragment}
|
${staffMemberDetailsFragment}
|
||||||
|
@ -114,3 +119,18 @@ export const TypedStaffAvatarDeleteMutation = TypedMutation<
|
||||||
StaffAvatarDelete,
|
StaffAvatarDelete,
|
||||||
StaffMemberDeleteVariables
|
StaffMemberDeleteVariables
|
||||||
>(staffAvatarDeleteMutation);
|
>(staffAvatarDeleteMutation);
|
||||||
|
|
||||||
|
const changeStaffPassword = gql`
|
||||||
|
mutation ChangeStaffPassword($newPassword: String!, $oldPassword: String!) {
|
||||||
|
passwordChange(newPassword: $newPassword, oldPassword: $oldPassword) {
|
||||||
|
errors {
|
||||||
|
field
|
||||||
|
message
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
export const useChangeStaffPassword = makeMutation<
|
||||||
|
ChangeStaffPassword,
|
||||||
|
ChangeStaffPasswordVariables
|
||||||
|
>(changeStaffPassword);
|
||||||
|
|
27
src/staff/types/ChangeStaffPassword.ts
Normal file
27
src/staff/types/ChangeStaffPassword.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// This file was automatically generated and should not be edited.
|
||||||
|
|
||||||
|
// ====================================================
|
||||||
|
// GraphQL mutation operation: ChangeStaffPassword
|
||||||
|
// ====================================================
|
||||||
|
|
||||||
|
export interface ChangeStaffPassword_passwordChange_errors {
|
||||||
|
__typename: "Error";
|
||||||
|
field: string | null;
|
||||||
|
message: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ChangeStaffPassword_passwordChange {
|
||||||
|
__typename: "PasswordChange";
|
||||||
|
errors: ChangeStaffPassword_passwordChange_errors[] | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ChangeStaffPassword {
|
||||||
|
passwordChange: ChangeStaffPassword_passwordChange | null;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ChangeStaffPasswordVariables {
|
||||||
|
newPassword: string;
|
||||||
|
oldPassword: string;
|
||||||
|
}
|
Loading…
Reference in a new issue