Skip to content
This repository has been archived by the owner on Nov 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #11 from UnownHash/remove-deprecated
Browse files Browse the repository at this point in the history
remove deprecated
  • Loading branch information
TurtIeSocks authored Apr 18, 2023
2 parents 1ad50ba + ffc754f commit f477c10
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 0 additions & 2 deletions client/src/features/area/AreaExpand.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export const AreaExpand = () => {
body: JSON.stringify({ fence: record.geofence }),
}).then((res) => res.json()),
)

console.log(data)
return (
<div>
<Typography variant="caption">
Expand Down
11 changes: 4 additions & 7 deletions server/routes/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package routes
import (
"encoding/json"
"flygon-admin/server/config"
"io/ioutil"

"github.com/gin-gonic/gin"
)
Expand All @@ -14,14 +13,12 @@ type Auth struct {
}

func Login(c *gin.Context) {
body, err := ioutil.ReadAll(c.Request.Body)
if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
}

defer c.Request.Body.Close()

var data Auth
err = json.Unmarshal(body, &data)
err := json.NewDecoder(c.Request.Body).Decode(&data)

if err != nil {
c.JSON(500, gin.H{"error": err.Error()})
return
Expand Down
12 changes: 4 additions & 8 deletions server/routes/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"flygon-admin/server/config"
"flygon-admin/server/util"
"fmt"
"io/ioutil"
"net/http"
"strings"

Expand Down Expand Up @@ -56,20 +55,17 @@ func buildRequest(dest string, c *gin.Context) (int, string, error) {
return 500, fullUrl, err
}

body, err := ioutil.ReadAll(res.Body)
if err != nil {
return res.StatusCode, fullUrl, err
}
defer res.Body.Close()

// Types are not saved here since the request is just being proxied
// Reference Flygon & Golbat repos for the full types
var data interface{}
err = json.Unmarshal(body, &data)
var body interface{}
err = json.NewDecoder(res.Body).Decode(&body)
if err != nil {
return res.StatusCode, fullUrl, err
}

c.JSON(res.StatusCode, data)
c.JSON(res.StatusCode, body)
return res.StatusCode, fullUrl, nil
}

Expand Down

0 comments on commit f477c10

Please sign in to comment.