
* Svelte: WIP * WIP * WIP * WIP * WIP * WIP * Finished * Remove redundant code * Fix typo * Re-add routes * Form margin * Mobile nicities * Mobile changed * Increase keepalvie * Update Guild.svelte * Update Whitelabel.svelte * Whitelabel changes
32 lines
566 B
Go
32 lines
566 B
Go
package api
|
|
|
|
import (
|
|
"github.com/TicketsBot/GoPanel/app/http/session"
|
|
"github.com/TicketsBot/GoPanel/utils"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func SessionHandler(ctx *gin.Context) {
|
|
userId := ctx.Keys["userid"].(uint64)
|
|
|
|
store, err := session.Store.Get(userId)
|
|
if err != nil {
|
|
if err == session.ErrNoSession {
|
|
ctx.JSON(404, gin.H{
|
|
"success": false,
|
|
"error": err.Error(),
|
|
"auth": true,
|
|
})
|
|
} else {
|
|
ctx.JSON(500, utils.ErrorJson(err))
|
|
}
|
|
|
|
return
|
|
}
|
|
|
|
ctx.JSON(200, gin.H{
|
|
"username": store.Name,
|
|
"avatar": store.Avatar,
|
|
})
|
|
}
|