-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restructures Admin Backend #40
Conversation
check the kratos.go file in the config folder and make a function for admin URL as well, instead of hardcoding the admin URL everywhere |
we need to keep all the requests in json format, so change the request from forms to JSON format |
ef34674
to
008e54b
Compare
api/admin.go
Outdated
data, _ := json.Marshal(t) | ||
json.Unmarshal(data, &mappedJsonIdentity) | ||
|
||
adminCreateIdentityBody := *client.NewAdminCreateIdentityBody( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move this to wrapper
api/admin.go
Outdated
var mappedJsonIdentity map[string]interface{} | ||
|
||
data, _ := json.Marshal(t) | ||
json.Unmarshal(data, &mappedJsonIdentity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error handling please
api/admin.go
Outdated
log.ErrorLogger("Error while calling `AdminCreateIdentity`", err) | ||
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) | ||
c.JSON(http.StatusInternalServerError, gin.H{ | ||
"error": "INternal server error", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'N' shouldn't be capital
api/admin.go
Outdated
|
||
var mappedJsonIdentity map[string]interface{} | ||
|
||
data, _ := json.Marshal(t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error handling
api/admin.go
Outdated
return | ||
} | ||
|
||
jsonString, _ := json.Marshal(getIdentity.Traits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error handling
api/admin.go
Outdated
var identity admin.Identity | ||
|
||
if err := json.Unmarshal(jsonString, &identity); err != nil { | ||
fmt.Println(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use logger
api/mfa.go
Outdated
@@ -51,8 +53,11 @@ func HandlePostMFAFlow(c *gin.Context) { | |||
}) | |||
return | |||
} | |||
session_cookie, _ := c.Cookie("sdslabs_session") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error handling
LGTM |
No description provided.