This commit is contained in:
@@ -1,20 +1,19 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"dypid-client/config"
|
||||
"io"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func uploadDataToServer(httpClient *http.Client, data string) error {
|
||||
func UploadDataToServer(httpClient *http.Client, data string) error {
|
||||
params := url.Values{}
|
||||
params.Set("token", viper.GetString("token"))
|
||||
params.Set("token", config.APPConfig.Token)
|
||||
params.Set("data", data)
|
||||
|
||||
resp, err := httpClient.Post(viper.GetString("url")+"/api/data?"+params.Encode(), "application/x-www-form-urlencoded", strings.NewReader(""))
|
||||
resp, err := httpClient.Post(config.APPConfig.Url+"/api/data?"+params.Encode(), "application/x-www-form-urlencoded", strings.NewReader(""))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user