Skip to content

Commit

Permalink
Merge Encode query components to handle special characters (#138)
Browse files Browse the repository at this point in the history
Closes #115
  • Loading branch information
MiraGeowerkstatt authored Jul 28, 2022
2 parents c21222b + 0ea17e8 commit f56804b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ClientApp/cypress/integration/home.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe("Home page tests", () => {
it("Show search result box if search for grundbuchnummer", function () {
const gbnummer = "h5r0wdwsz6ef39zb2d31a0zfou7i4tdguvddcklb";
cy.intercept(
`/standort?gemeinde=&gbnummer=${gbnummer}&bezeichnung=&erstellungsdatum=&mutationsdatum=`,
`/standort?gemeinde=null&gbnummer=${gbnummer}&bezeichnung=&erstellungsdatum=&mutationsdatum=`,
standorteGbnummer
);
cy.visit("/");
Expand All @@ -41,7 +41,7 @@ describe("Home page tests", () => {

it("Show search result box if search for bezeichnung", function () {
cy.intercept(
`/standort?gemeinde=&gbnummer=&bezeichnung=Rustic%20Wooden%20Keyboard&erstellungsdatum=&mutationsdatum=`,
`/standort?gemeinde=null&gbnummer=&bezeichnung=Rustic%20Wooden%20Keyboard&erstellungsdatum=&mutationsdatum=`,
standorteBezeichnung
);
cy.visit("/");
Expand Down
5 changes: 3 additions & 2 deletions src/ClientApp/src/components/Search.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export default function Search(props) {
const { isDirty } = formState;

const onSearch = (formData) => {
let query = `?gemeinde=${formData.gemeinde || ""}`;
query += `&gbnummer=${formData.gbnummer}&bezeichnung=${formData.bezeichnung}`;
let query = `?gemeinde=${encodeURIComponent(formData.gemeinde) || ""}`;
query += `&gbnummer=${encodeURIComponent(formData.gbnummer)}`;
query += `&bezeichnung=${encodeURIComponent(formData.bezeichnung)}`;
query += `&erstellungsdatum=${formData.erstellungsDatum ? new Date(formData.erstellungsDatum).toDateString() : ""}`;
query += `&mutationsdatum=${formData.mutationsDatum ? new Date(formData.mutationsDatum).toDateString() : ""}`;
getStandorte(query);
Expand Down

0 comments on commit f56804b

Please sign in to comment.