Add theme listing
This commit is contained in:
parent
b958b01635
commit
40f7d7a0be
2 changed files with 26 additions and 1 deletions
|
@ -13,7 +13,7 @@ type DispatchFunction func([]string, []byte) (interface{}, error)
|
||||||
|
|
||||||
var apiRouting = map[string]*(map[string]DispatchFunction){
|
var apiRouting = map[string]*(map[string]DispatchFunction){
|
||||||
"version": &ApiVersionRouting,
|
"version": &ApiVersionRouting,
|
||||||
//"themes": &ApiThemesRouting,
|
"themes": &ApiThemesRouting,
|
||||||
"teams": &ApiTeamsRouting,
|
"teams": &ApiTeamsRouting,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
25
admin/api_theme.go
Normal file
25
admin/api_theme.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"strconv"
|
||||||
|
)
|
||||||
|
|
||||||
|
var ApiThemesRouting = map[string]DispatchFunction{
|
||||||
|
"GET": listTheme,
|
||||||
|
}
|
||||||
|
|
||||||
|
func listTheme(args []string, body []byte) (interface{}, error) {
|
||||||
|
if len(args) == 1 {
|
||||||
|
// List given theme
|
||||||
|
if tid, err := strconv.Atoi(string(args[0])); err != nil {
|
||||||
|
return nil, err
|
||||||
|
} else {
|
||||||
|
return GetTheme(tid)
|
||||||
|
}
|
||||||
|
} else if len(args) == 0 {
|
||||||
|
// List all themes
|
||||||
|
return GetThemes()
|
||||||
|
} else {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
}
|
Reference in a new issue