Skip to content

Commit

Permalink
Fix user db path
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoduykhanh committed May 22, 2020
1 parent 216d790 commit 175a3be
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions util/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func InitDB() error {
user := new(model.User)
user.Username = defaultUsername
user.Password = defaultPassword
db.Write("server", "user", user)
db.Write("server", "users", user)
}

return nil
Expand All @@ -129,7 +129,7 @@ func GetUser() (model.User, error) {
return user, err
}

if err := db.Read("server", "user", &user); err != nil {
if err := db.Read("server", "users", &user); err != nil {
return user, err
}

Expand Down Expand Up @@ -181,7 +181,7 @@ func GetServer() (model.Server, error) {

// GetClients to get all clients from the database
func GetClients(hasQRCode bool) ([]model.ClientData, error) {
clients := []model.ClientData{}
var clients []model.ClientData

db, err := DBConn()
if err != nil {
Expand All @@ -201,7 +201,7 @@ func GetClients(hasQRCode bool) ([]model.ClientData, error) {

// get client info
if err := json.Unmarshal([]byte(f), &client); err != nil {
return clients, fmt.Errorf("Cannot decode client json structure: %v", err)
return clients, fmt.Errorf("cannot decode client json structure: %v", err)
}

// generate client qrcode image in base64
Expand Down

0 comments on commit 175a3be

Please sign in to comment.