Skip to content

Commit

Permalink
Merge pull request #51 from ChangePlusPlusVandy/updating-passenger-fr…
Browse files Browse the repository at this point in the history
…ontend

Fixed passenger updateability
  • Loading branch information
franklinhu88 authored Nov 3, 2024
2 parents 093b66b + 73df079 commit 4db0bc7
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions src/api/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,39 @@ export const updatePassenger = (
Street: string;
Country: string;
Email: string;
DateOfBirth: string;
MilitaryService: string;
Gender: string;
Notes?: string;
},
airtableRecordId: string,
token?: string | null,
): Promise<PassengerData> =>
axios
.put(`${process.env.VITE_HOST}/passenger/${airtableRecordId}`, passenger, {
): Promise<PassengerData> => {
const airtableFields: { [key: string]: string | number | unknown } = {
Street: passenger.Street,
Country: passenger.Country,
Email: passenger.Email,
Gender: passenger.Gender,
"Date of Birth": passenger.DateOfBirth, // Correct Airtable field name
"Military Service": passenger.MilitaryService,
};
const data = {
records: [
{
id: airtableRecordId,
fields: airtableFields,
},
],
};

return axios
.put(`${process.env.VITE_HOST}/passenger/${airtableRecordId}`, data, {
headers: {
Authorization: `Bearer ${token}`,
},
})
.then((res) => res.data);
};

export const getAllFlightsForUser = (
userId: string,
Expand Down

0 comments on commit 4db0bc7

Please sign in to comment.