Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
gmat224 committed Dec 12, 2024
2 parents 77a1aae + 1407b96 commit 94edd58
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ app.use(
"Access-Control-Allow-Origin",
"Access-Control-Allow-Headers",
"Content-type",
"Authorization",
"Origin",
"Access-Control-Allow-Origin",
"Accept",
"Options",
"X-Requested-With",
Expand Down
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 94edd58

Please sign in to comment.