🐛 Fix panics
This commit is contained in:
parent
6d7f0b0518
commit
52d6d17bf6
@ -7,13 +7,13 @@ import (
|
|||||||
func MapAPIs(app *fiber.App, baseURL string) {
|
func MapAPIs(app *fiber.App, baseURL string) {
|
||||||
api := app.Group(baseURL).Name("API")
|
api := app.Group(baseURL).Name("API")
|
||||||
{
|
{
|
||||||
wallet := api.Group("/wallet").Name("Wallet API")
|
wallet := api.Group("/wallets").Name("Wallet API")
|
||||||
{
|
{
|
||||||
wallet.Post("/me", createWallet)
|
wallet.Post("/me", createWallet)
|
||||||
wallet.Get("/me", getMyWallet)
|
wallet.Get("/me", getMyWallet)
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction := api.Group("/transaction").Name("Transaction API")
|
transaction := api.Group("/transactions").Name("Transaction API")
|
||||||
{
|
{
|
||||||
transaction.Get("/me", getTransaction)
|
transaction.Get("/me", getTransaction)
|
||||||
transaction.Get("/:id", getTransactionByID)
|
transaction.Get("/:id", getTransactionByID)
|
||||||
|
@ -14,7 +14,7 @@ func getTransaction(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 {
|
||||||
@ -46,7 +46,7 @@ func getTransactionByID(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 transaction models.Transaction
|
var transaction models.Transaction
|
||||||
if err := database.C.Where("id = ?", id).
|
if err := database.C.Where("id = ?", id).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user