fix cwapi bug with new sling usage (#157)
* fix sling usage Co-authored-by: AlteredCoder <AlteredCoder>
This commit is contained in:
parent
89c8d1a527
commit
5e561e30bd
|
@ -142,7 +142,7 @@ func (ctx *ApiCtx) Signin() error {
|
|||
}
|
||||
jsonResp := &ApiResp{}
|
||||
|
||||
resp, err := ctx.Http.Post(ctx.SigninPath).BodyJSON(ctx.Creds).ReceiveSuccess(jsonResp)
|
||||
resp, err := ctx.Http.New().Post(ctx.SigninPath).BodyJSON(ctx.Creds).ReceiveSuccess(jsonResp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("api signin: HTTP request creation failed: %s", err)
|
||||
}
|
||||
|
@ -155,6 +155,7 @@ func (ctx *ApiCtx) Signin() error {
|
|||
}
|
||||
|
||||
ctx.Http = ctx.Http.Set("Authorization", jsonResp.Message)
|
||||
|
||||
log.Printf("api signin: signed in successfuly")
|
||||
return nil
|
||||
}
|
||||
|
@ -164,7 +165,7 @@ func (ctx *ApiCtx) RegisterMachine(machineID string, password string) error {
|
|||
ctx.Creds.Password = password
|
||||
jsonResp := &ApiResp{}
|
||||
|
||||
resp, err := ctx.Http.Post(ctx.RegisterPath).BodyJSON(ctx.Creds).ReceiveSuccess(jsonResp)
|
||||
resp, err := ctx.Http.New().Post(ctx.RegisterPath).BodyJSON(ctx.Creds).ReceiveSuccess(jsonResp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("api register machine: HTTP request creation failed: %s", err)
|
||||
}
|
||||
|
@ -185,7 +186,7 @@ func (ctx *ApiCtx) ResetPassword(machineID string, password string) error {
|
|||
jsonResp := &ApiResp{}
|
||||
|
||||
data := map[string]string{"machine_id": ctx.Creds.User, "password": ctx.Creds.Password}
|
||||
resp, err := ctx.Http.Post(ctx.ResetPwdPath).BodyJSON(data).ReceiveSuccess(jsonResp)
|
||||
resp, err := ctx.Http.New().Post(ctx.ResetPwdPath).BodyJSON(data).ReceiveSuccess(jsonResp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("api reset password: HTTP request creation failed: %s", err)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ func (ctx *ApiCtx) Enroll(userID string) error {
|
|||
toPush := map[string]string{"user_id": userID}
|
||||
jsonResp := &ApiResp{}
|
||||
|
||||
resp, err := ctx.Http.Post(ctx.EnrollPath).BodyJSON(&toPush).ReceiveSuccess(jsonResp)
|
||||
resp, err := ctx.Http.New().Post(ctx.EnrollPath).BodyJSON(&toPush).ReceiveSuccess(jsonResp)
|
||||
if err != nil {
|
||||
return fmt.Errorf("api enroll: HTTP request creation failed: %s", err)
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
|
||||
func (ctx *ApiCtx) PullTop() ([]map[string]string, error) {
|
||||
top := &PullResp{}
|
||||
resp, err := ctx.Http.Get(ctx.PullPath).ReceiveSuccess(top)
|
||||
resp, err := ctx.Http.New().Get(ctx.PullPath).ReceiveSuccess(top)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("api pull: HTTP request creation failed: %s", err)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue