Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 2x 2x 2x 3x 3x 2x 2x 3x 3x 2x 2x | import axios from 'axios';
export const apiUpdateActiveDotbotAddress = async (address) => {
return await axios.put(
`${process.env.REACT_APP_DOTBOTS_BASE_URL}/controller/dotbot_address`,
{ address: address },
{ headers: { 'Content-Type': 'application/json' } }
);
}
export const apiFetchDotbots = async () => {
return await axios.get(
`${process.env.REACT_APP_DOTBOTS_BASE_URL}/controller/dotbots`,
).then(res => res.data);
}
export const apiFetchDotbot = async (address) => {
return await axios.get(
`${process.env.REACT_APP_DOTBOTS_BASE_URL}/controller/dotbots/${address}`,
).then(res => res.data);
}
export const apiFetchActiveDotbotAddress = async () => {
return await axios.get(
`${process.env.REACT_APP_DOTBOTS_BASE_URL}/controller/dotbot_address`,
).then(res => res.data.address);
}
export const apiUpdateMoveRaw = async (address, left, right) => {
const command = { left_x: 0, left_y: left, right_x: 0, right_y: right };
return await axios.put(
`${process.env.REACT_APP_DOTBOTS_BASE_URL}/controller/dotbots/${address}/move_raw`,
command,
{ headers: { 'Content-Type': 'application/json' } }
);
}
export const apiUpdateRgbLed = async (address, red, green, blue) => {
const command = { red: red, green: green, blue: blue };
return await axios.put(
`${process.env.REACT_APP_DOTBOTS_BASE_URL}/controller/dotbots/${address}/rgb_led`,
command,
{ headers: { 'Content-Type': 'application/json' } }
);
}
|