Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: connect complaints to backend #860

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ jobs:
with:
sha: ${{ github.sha }}
token: ${{ secrets.GITHUB_TOKEN }}
description: 'Playwright html report with traces'
description: 'See Playwright test results'
status: ${{needs.test.result}}
context: 'Test results'
targetUrl: 'https://s3.amazonaws.com/noam-gaash.co.il/${{ github.run_id }}/open-bus/${{ github.sha }}/test-results/index.html'
Expand Down
17 changes: 14 additions & 3 deletions src/pages/components/map-related/MapLayers/ComplaintModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,29 @@ const ComplaintModal = ({ modalOpen, setModalOpen, position }: ComplaintModalPro
setComplaintData((prevData) => ({ ...prevData, [name]: value }) as const)
}
const handleSubmit = (e: React.FormEvent<HTMLFormElement>) => {
console.log(`lalalala`)
e.preventDefault()
const complaintPayload = {
reportId: new Date().toISOString(),
reportType: 'databusUiComplaint',
userData: complaintData,
databusData: {
operator: siriRide?.gtfsRideGtfsRouteId,
...position,
},
}
console.log(complaintPayload)
// Handle the form submission, e.g., send it to an API
setModalOpen(false)

fetch('https://u50mqjjsc2.execute-api.us-west-1.amazonaws.com/report', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(complaintPayload),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error(error))
.then(() => setModalOpen(false))
}

return (
Expand Down
Loading