Skip to content

Commit

Permalink
fix: passed the full position from the frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
addegbenga committed Apr 10, 2024
1 parent e02f052 commit d65b95a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions backend/routes/pixel.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ func placePixelDevnet(w http.ResponseWriter, r *http.Request) {
}

shellCmd := backend.ArtPeaceBackend.BackendConfig.Scripts.PlacePixelDevnet
computedPosition := x + y * int(backend.ArtPeaceBackend.CanvasConfig.Canvas.Width)
contract := os.Getenv("ART_PEACE_CONTRACT_ADDRESS")
cmd := exec.Command(shellCmd, contract, "place_pixel", strconv.Itoa(computedPosition), jsonBody["color"])

cmd := exec.Command(shellCmd, contract, "place_pixel", strconv.Itoa(position), jsonBody["color"])
_, err = cmd.Output()
if err != nil {
fmt.Println("Error executing shell command: ", err)
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/canvas/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ const Canvas = props => {
return
}

const position = props.selectedPositionX + props.selectedPositionY
const position = props.selectedPositionX + props.selectedPositionY * width
const colorIdx = props.selectedColorId
let placePixelEndpoint = backendUrl + "/placePixelDevnet"
fetch(placePixelEndpoint, {
Expand Down

0 comments on commit d65b95a

Please sign in to comment.