Preparing a new data set
Configuring the query builder with geographic data fields
Now that we have our new API endpoint up and running, we can modify the client to query on the fields from the new data set.
Dataset switching#
In the client code, add a new type to the file types.ts
called Dataset
.
1
export type Language = "en" | "es";
2
export type Dataset = "sales" | "unlocode";
Add a state variable to hold the dataset and add a dataset selector to the top of the return
statement in App.tsx
.
1
import { Dataset, Language } from "./types";
1
const [dataset, setDataset] = useState<Dataset>("sales");
1
<select value={dataset} onChange={(e) => setDataset(e.target.value as Dataset)}>
2
<option value="sales">Sales</option>
3
<option value="unlocode">UN/LOCODE</option>
4
</select>
Loading...