Skip to content

Commit 5c10c13

Browse files
committed
chore: update login struct
1 parent 17d49ed commit 5c10c13

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

api/auth.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
package api
22

3-
// AuthResponse is the API message for user login.
3+
// Login is the API message for user login.
4+
type Login struct {
5+
Email string `json:"email"`
6+
Password string `json:"password"`
7+
}
8+
9+
// AuthResponse is the API message for user login response.
410
type AuthResponse struct {
511
UserID int `json:"userId"`
612
Username string `json:"username"`

client/client.go

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,7 @@ type client struct {
1717
HostURL string
1818
HTTPClient *http.Client
1919
Token string
20-
Auth *authStruct
21-
}
22-
23-
type authStruct struct {
24-
Email string `json:"email"`
25-
Password string `json:"password"`
20+
Auth *api.Login
2621
}
2722

2823
// NewClient returns the new Bytebase API client.
@@ -32,7 +27,7 @@ func NewClient(url, email, password string) (api.Client, error) {
3227
HostURL: url,
3328
}
3429

35-
c.Auth = &authStruct{
30+
c.Auth = &api.Login{
3631
Email: email,
3732
Password: password,
3833
}

0 commit comments

Comments
 (0)