Advertisement
langbung01

Untitled

Jan 9th, 2019
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   getProvince = async () => {
  2.     const response = await axios.get(`${process.env.MIX_BACKEND_IP}/api/get_province`);
  3.     if (response.status === 200) {
  4.       this.setState({
  5.         provinceList: response.data.data,
  6.       });
  7.     }
  8.   };
  9.  
  10.   getZipcode = async () => {
  11.     const response = await axios.get(
  12.       `${process.env.MIX_BACKEND_IP}/api/zipcode`,
  13.       {
  14.         params: {
  15.           province: this.state.province,
  16.           amphoe: this.state.amphoe,
  17.           tambon: this.state.tambon,
  18.           zipcode: this.state.zipcode,
  19.         },
  20.       },
  21.     );
  22.     if (response.status === 200) {
  23.       this.setState({
  24.         zipcodeList: response.data.data.zipcode,
  25.       });
  26.     }
  27.   };
  28.  
  29.   getAmphoe = async () => {
  30.     const response = await axios.get(
  31.       `${process.env.MIX_BACKEND_IP}/api/zipcode`,
  32.       {
  33.         params: {
  34.           province: this.state.province,
  35.           amphoe: this.state.amphoe,
  36.           tambon: this.state.tambon,
  37.           zipcode: this.state.zipcode,
  38.         },
  39.       },
  40.     );
  41.     if (response.status === 200) {
  42.       this.setState({
  43.         amphoeList: response.data.data.amphoe,
  44.         tambonList: response.data.data.tambon,
  45.         zipcodeList: response.data.data.zipcode,
  46.       });
  47.     }
  48.   };
  49.  
  50. getTambon = async () => {
  51.     const response = await axios.get(
  52.       `${process.env.MIX_BACKEND_IP}/api/zipcode`,
  53.       {
  54.         params: {
  55.           province: this.state.province,
  56.           amphoe: this.state.amphoe,
  57.           tambon: this.state.tambon,
  58.           zipcode: this.state.zipcode,
  59.         },
  60.       },
  61.     );
  62.     if (response.status === 200) {
  63.       this.setState({
  64.         tambonList: response.data.data.tambon,
  65.       });
  66.     }
  67.   };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement