🐛 Fix panic issue
This commit is contained in:
parent
2cd65fd830
commit
b91fa1d01d
@ -2,6 +2,7 @@ package api
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"git.solsynth.dev/hypernet/wallet/pkg/internal/server/exts"
|
"git.solsynth.dev/hypernet/wallet/pkg/internal/server/exts"
|
||||||
|
|
||||||
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
"git.solsynth.dev/hypernet/nexus/pkg/nex/sec"
|
||||||
@ -16,7 +17,7 @@ func createWallet(c *fiber.Ctx) error {
|
|||||||
if err := sec.EnsureGrantedPerm(c, "CreateWallet", true); err != nil {
|
if err := sec.EnsureGrantedPerm(c, "CreateWallet", true); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
user := c.Locals("user").(*sec.UserInfo)
|
user := c.Locals("nex_user").(*sec.UserInfo)
|
||||||
|
|
||||||
var data struct {
|
var data struct {
|
||||||
Password string `json:"password" validate:"min=4"`
|
Password string `json:"password" validate:"min=4"`
|
||||||
@ -48,7 +49,7 @@ func getMyWallet(c *fiber.Ctx) error {
|
|||||||
if err := sec.EnsureAuthenticated(c); err != nil {
|
if err := sec.EnsureAuthenticated(c); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
user := c.Locals("user").(*sec.UserInfo)
|
user := c.Locals("nex_user").(*sec.UserInfo)
|
||||||
|
|
||||||
var wallet models.Wallet
|
var wallet models.Wallet
|
||||||
if err := database.C.Where("account_id = ?", user.ID).First(&wallet).Error; err != nil {
|
if err := database.C.Where("account_id = ?", user.ID).First(&wallet).Error; err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user