Skip to content

Commit

Permalink
Modify auth.session.service.js
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Mar 13, 2018
1 parent 9781a8e commit 29f5aff
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
10 changes: 5 additions & 5 deletions client/go/dogma/dogma.go
Expand Up @@ -78,7 +78,7 @@ const (
type Client struct {
client *http.Client // HTTP client which sends the request.

BaseURL *url.URL // Base URL for API requests.
baseURL *url.URL // Base URL for API requests.

// Services are used to communicate for the different parts of the Central Dogma server API.
project *projectService
Expand Down Expand Up @@ -112,7 +112,7 @@ func NewClientWithHTTPClient(baseURL string, client *http.Client) (*Client, erro

c := &Client{
client: client,
BaseURL: normalizedURL,
baseURL: normalizedURL,
}
service := &service{client: c}

Expand Down Expand Up @@ -152,7 +152,7 @@ func normalizeURL(baseURL string) (*url.URL, error) {

// SecurityEnabled returns whether the security of the server is enabled or not.
func (c *Client) SecurityEnabled() (bool, error) {
u, err := c.BaseURL.Parse(pathSecurityEnabled)
u, err := c.baseURL.Parse(pathSecurityEnabled)
if err != nil {
return false, err
}
Expand All @@ -175,7 +175,7 @@ func (c *Client) SecurityEnabled() (bool, error) {
}

func (c *Client) newRequest(method, urlStr string, body interface{}) (*http.Request, error) {
u, err := c.BaseURL.Parse(urlStr)
u, err := c.baseURL.Parse(urlStr)
if err != nil {
return nil, err
}
Expand All @@ -187,7 +187,7 @@ func (c *Client) newRequest(method, urlStr string, body interface{}) (*http.Requ
} else {
buf = new(bytes.Buffer)
enc := json.NewEncoder(buf)
//enc.SetEscapeHTML(true)
enc.SetEscapeHTML(true)
err := enc.Encode(body)
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion client/go/dogma/dogma_test.go
Expand Up @@ -117,7 +117,7 @@ func TestNewClientWithHTTPClient(t *testing.T) {
}

for _, test := range tests {
if got, _ := NewClientWithHTTPClient(test.baseURL, http.DefaultClient); got.BaseURL.String() != test.want {
if got, _ := NewClientWithHTTPClient(test.baseURL, http.DefaultClient); got.baseURL.String() != test.want {
t.Errorf("NewClientWithHTTPClient BaseURL is %v, want %v", got, test.want)
}
}
Expand Down
Expand Up @@ -12,9 +12,13 @@ angular.module('CentralDogmaAdmin')
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
}).then(function (sessionId) {
if (sessionId !== null) {
$window.localStorage.setItem('sessionId', sessionId);
}).then(function (accessToken) {
var sessionId;
if (accessToken !== null) {
sessionId = angular.fromJson(accessToken).access_token;
if (sessionId !== null) {
$window.localStorage.setItem('sessionId', sessionId);
}
}
return sessionId;
});
Expand Down

0 comments on commit 29f5aff

Please sign in to comment.