import axios from "axios"; import React, { useEffect, useState } from "react"; import { Form } from "react-bootstrap"; import { callUserInfo } from "../utils/CheckDB"; import { isLogined } from "./../utils/Auth"; import { routesClient } from './../routesClient'; function UsingAircon() { const [airUsing, setAirUsing] = useState(''); console.log("change airUsing", airUsing); async function airChange() { setAirUsing(!airUsing); await axios.get(routesClient.usingAircon, { using_aircon: !airUsing }) } useEffect(() => { callUserInfo().then((res) => { setAirUsing(res[0]['using_aircon']) }) }, []) return ( <> {isLogined() && (