Skip to content

Commit

Permalink
fix broken ticket info update
Browse files Browse the repository at this point in the history
  • Loading branch information
Ratchet7x5 committed Dec 12, 2024
1 parent 7489ca6 commit 1407b96
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 12 additions & 0 deletions web/src/api/apiRequests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ export const updateUserInfo = async (data: object): Promise<AxiosResponse> => {
return response;
};

export const updateUserTicketInfo = async (
data: object
): Promise<AxiosResponse> => {
const response = await axios.post("/api/user/user-ticket-info", data, {
headers: {
"Content-Type": "application/json",
},
});

return response;
};

// User membership expiry
export const fetchUserMembershipExpiry =
async (): Promise<MembershipExpiryDate> => {
Expand Down
8 changes: 2 additions & 6 deletions web/src/components/forms/CheckoutInformation.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import axios from "axios";
import { QuestionAnswer, TicketAndQuestion } from "../../types/types";
import { useEffect, useState } from "react";
import { useQuery } from "@apollo/client";
Expand All @@ -7,6 +6,7 @@ import { Mapper } from "@utils/Mapper";
import LoadingSpinner from "@components/navigation/LoadingSpinner";
import { useNavigate } from "react-router";
import CheckoutInformationForm from "./CheckoutInformationForm";
import { updateUserTicketInfo } from "../../api/apiRequests";

interface CheckoutInformationProps {
ticketId: number;
Expand Down Expand Up @@ -68,11 +68,7 @@ export default function CheckoutInformation({
// Submit ticket information to backend
const onSubmit = async (data: any) => {
try {
const response = await axios.post("/api/user/user-ticket-info", data, {
headers: {
"Content-Type": "application/json",
},
});
const response = await updateUserTicketInfo(data);
if (response.status === 200) {
// Form Submission Successful
setSubmitLoading(false);
Expand Down

0 comments on commit 1407b96

Please sign in to comment.