lint
All checks were successful
backend-action / build-image (push) Successful in 1m9s

This commit is contained in:
2024-05-16 17:26:27 +07:00
parent 5c4abf24bb
commit c1a019a461
13 changed files with 246 additions and 63 deletions

View File

@@ -17,20 +17,20 @@ type Zone = {
province: number;
};
export default function LocationSelector({ provinces }: Props) {
let [provinceId, setProvinceId] = useState<number | undefined>(undefined);
let [amphurList, setAmphurList] = useState<Zone[] | undefined>(undefined);
let [amphurId, setAmphurId] = useState<number | undefined>(undefined);
const [provinceId, setProvinceId] = useState<number | undefined>(undefined);
const [amphurList, setAmphurList] = useState<Zone[] | undefined>(undefined);
const [amphurId, setAmphurId] = useState<number | undefined>(undefined);
const locationContext = useContext(LocationContext);
function setProvince(_id: string) {
let id = parseInt(_id);
const id = parseInt(_id);
setProvinceId(id);
let province = provinces.find((p) => p.id == id);
const province = provinces.find((p) => p.id == id);
if (province == undefined) return;
setAmphurList(province.zones);
setAmphurId(undefined);
}
function setAmphur(_id: string) {
let id = parseInt(_id);
const id = parseInt(_id);
setAmphurId(id);
}
useEffect(() => {

View File

@@ -21,8 +21,8 @@ export default function LocationContextProvider({
}: {
children?: ReactNode;
}) {
let zone = useState<number | undefined>(undefined);
let province = useState<number | undefined>(undefined);
const zone = useState<number | undefined>(undefined);
const province = useState<number | undefined>(undefined);
return (
<LocationContext.Provider value={{ zone, province }}>