fix: TryUserAuth set role in context, fix docs page pagination response handling
Docker Build / Build and Push Docker Image (push) Successful in 3m48s
Docker Build / Build and Push Docker Image (push) Successful in 3m48s
This commit is contained in:
@@ -163,6 +163,10 @@ func TryUserAuth() func(c *gin.Context) {
|
||||
if id != nil {
|
||||
c.Set("id", id)
|
||||
}
|
||||
role := session.Get("role")
|
||||
if role != nil {
|
||||
c.Set("role", role)
|
||||
}
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -51,12 +51,16 @@ interface DocDocument {
|
||||
|
||||
async function fetchCategories(): Promise<DocCategory[]> {
|
||||
const res = await api.get('/api/docs/categories')
|
||||
return res.data?.data ?? []
|
||||
const data = res.data?.data
|
||||
if (Array.isArray(data)) return data
|
||||
return data?.items ?? []
|
||||
}
|
||||
|
||||
async function fetchDocuments(): Promise<DocDocument[]> {
|
||||
const res = await api.get('/api/docs/')
|
||||
return res.data?.data ?? []
|
||||
const data = res.data?.data
|
||||
if (Array.isArray(data)) return data
|
||||
return data?.items ?? []
|
||||
}
|
||||
|
||||
async function fetchDocument(slug: string): Promise<DocDocument | null> {
|
||||
|
||||
Reference in New Issue
Block a user