Skip to content

Commit

Permalink
fix: user save unsave info
Browse files Browse the repository at this point in the history
  • Loading branch information
TeeGoood committed May 16, 2024
1 parent f249b0f commit e42b3ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/api/pets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const getPetsAdmin = async (filters?: filterState) => {

type postPetRequest = Omit<
Pet,
"id" | "images" | "is_club_pet" | "contact" | "owner" | "contact"
"id" | "images" | "is_club_pet"
> & {
images: string[]; // image id
};
Expand Down
6 changes: 6 additions & 0 deletions src/app/admin/pets/add/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ const adminCreate = () => {
nature: "-",
vaccine: false,
sterile: false,
owner: "-",
tel: "-",
contact: "-",
});

const [enableSubmit, setEnableSubmit] = useState(false);
Expand Down Expand Up @@ -91,6 +94,9 @@ const adminCreate = () => {
is_visible: true,
origin: `${origin === "fromClub" ? "club" : "entrust"}`,
images: allImage,
tel: info.tel,
contact: info.contact,
owner: info.owner,
};

postPetMutation.mutate(petData);
Expand Down
4 changes: 2 additions & 2 deletions src/components/Admin/Pets/Add/EditInfoAndSubmit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ const EditInfoAndSubmit = (props: EditInfoAndSubmitProps) => {
</p>
<Button
className="w-full text-2xl font-semibold"
text="โพสต์เลย"
text={enableEdit ? "โปรดบันทึกข้อมูลก่อนโพสต์" : "โพสต์เลย"}
onClick={props.onSubmit}
variant={props.enableSubmit ? "accent-red" : "disabled"}
variant={props.enableSubmit && !enableEdit ? "accent-red" : "disabled"}
rounded="full"
/>
</div>
Expand Down

0 comments on commit e42b3ed

Please sign in to comment.