Skip to content

Commit

Permalink
fix CORS with next config; move mp tracking up in incident search
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Yavorsky committed Nov 15, 2023
1 parent 32ce373 commit caa26d1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
13 changes: 7 additions & 6 deletions backend/routes/incidents.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,14 @@ def search_incidents():
page=body.page, per_page=body.perPage, max_per_page=100
)

track_to_mp(request, "search_incidents", {
"description": body.description,
"location": body.location,
"dateStart": body.dateStart,
"dateEnd": body.dateEnd,
})

try:
track_to_mp(request, "search_incidents", {
"description": body.description,
"location": body.location,
"dateStart": body.dateStart,
"dateEnd": body.dateEnd,
})
return {
"results": [
incident_orm_to_json(result) for result in results.items
Expand Down
18 changes: 18 additions & 0 deletions frontend/next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
module.exports = {
headers() {
return [
{
// matching all API routes
source: "/api/:path*",
headers: [
{ key: "Access-Control-Allow-Credentials", value: "true" },
{ key: "Access-Control-Allow-Origin", value: "*" }, // replace this your actual origin
{ key: "Access-Control-Allow-Methods", value: "GET,DELETE,PATCH,POST,PUT" },
{
key: "Access-Control-Allow-Headers",
value:
"X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version"
}
]
}
]
},
eslint: {
dirs: ["tests", "shared-components", "pages", "models", "helpers", "compositions"]
}
Expand Down

0 comments on commit caa26d1

Please sign in to comment.