Removed the extra getDefaultTemplate API as its not needed
This commit is contained in:
parent
e51edd4df5
commit
3679e04d44
3 changed files with 1 additions and 67 deletions
|
@ -76,7 +76,6 @@ func (a *API) RegisterRoutes(r *mux.Router) {
|
|||
apiv1.HandleFunc("/teams/{teamID}/boards", a.sessionRequired(a.handleGetBoards)).Methods("GET")
|
||||
apiv1.HandleFunc("/teams/{teamID}/boards/search", a.sessionRequired(a.handleSearchBoards)).Methods("GET")
|
||||
apiv1.HandleFunc("/teams/{teamID}/templates", a.sessionRequired(a.handleGetTemplates)).Methods("GET")
|
||||
apiv1.HandleFunc("/templates", a.sessionRequired(a.handleGetDefaultTemplates)).Methods("GET")
|
||||
apiv1.HandleFunc("/boards", a.sessionRequired(a.handleCreateBoard)).Methods("POST")
|
||||
apiv1.HandleFunc("/boards/{boardID}", a.attachSession(a.handleGetBoard, false)).Methods("GET")
|
||||
apiv1.HandleFunc("/boards/{boardID}", a.sessionRequired(a.handlePatchBoard)).Methods("PATCH")
|
||||
|
@ -2211,62 +2210,6 @@ func (a *API) handleGetTemplates(w http.ResponseWriter, r *http.Request) {
|
|||
auditRec.Success()
|
||||
}
|
||||
|
||||
func (a *API) handleGetDefaultTemplates(w http.ResponseWriter, r *http.Request) {
|
||||
// swagger:operation GET /api/v1/templates getDefaultTemplates
|
||||
//
|
||||
// Returns default templates
|
||||
//
|
||||
// ---
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: teamID
|
||||
// in: path
|
||||
// description: Team ID
|
||||
// required: true
|
||||
// type: string
|
||||
// security:
|
||||
// - BearerAuth: []
|
||||
// responses:
|
||||
// '200':
|
||||
// description: success
|
||||
// schema:
|
||||
// type: array
|
||||
// items:
|
||||
// items:
|
||||
// "$ref": "#/definitions/Board"
|
||||
// default:
|
||||
// description: internal error
|
||||
// schema:
|
||||
// "$ref": "#/definitions/ErrorResponse"
|
||||
|
||||
auditRec := a.makeAuditRecord(r, "getDefaultTemplates", audit.Fail)
|
||||
defer a.audit.LogRecord(audit.LevelRead, auditRec)
|
||||
|
||||
// retrieve boards list
|
||||
boards, err := a.app.GetDefaultTemplates()
|
||||
if err != nil {
|
||||
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
}
|
||||
|
||||
a.logger.Debug("GetDefaultTemplates",
|
||||
mlog.Int("boardsCount", len(boards)),
|
||||
)
|
||||
|
||||
data, err := json.Marshal(boards)
|
||||
if err != nil {
|
||||
a.errorResponse(w, r.URL.Path, http.StatusInternalServerError, "", err)
|
||||
return
|
||||
}
|
||||
|
||||
// response
|
||||
jsonBytesResponse(w, http.StatusOK, data)
|
||||
|
||||
auditRec.AddMeta("templatesCount", len(boards))
|
||||
auditRec.Success()
|
||||
}
|
||||
|
||||
// subscriptions
|
||||
|
||||
func (a *API) handleCreateSubscription(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
|
@ -600,15 +600,6 @@ class OctoClient {
|
|||
return this.getBoardsWithPath(path)
|
||||
}
|
||||
|
||||
async getDefaultTemplates(): Promise<Board[]> {
|
||||
const path = '/api/v1/templates'
|
||||
const response = await fetch(this.getBaseURL() + path, {headers: this.headers()})
|
||||
if (response.status !== 200) {
|
||||
return []
|
||||
}
|
||||
return (await this.getJson(response, [])) as Board[]
|
||||
}
|
||||
|
||||
// Boards
|
||||
// ToDo: .
|
||||
// - goal? make the interface show boards & blocks for boards
|
||||
|
|
|
@ -13,7 +13,7 @@ import {RootState} from './index'
|
|||
export const fetchGlobalTemplates = createAsyncThunk(
|
||||
'globalTemplates/fetch',
|
||||
async () => {
|
||||
const templates = await client.getDefaultTemplates()
|
||||
const templates = await client.getTeamTemplates('0')
|
||||
return templates.sort((a, b) => a.title.localeCompare(b.title))
|
||||
},
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue