diff options
author | Nick Thomas <nick@gitlab.com> | 2018-10-03 00:00:38 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2018-10-05 11:34:43 +0100 |
commit | 25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64 (patch) | |
tree | faef4e9d73e9845413462013c868eace19a11abf /app/assets/javascripts/ide/stores | |
parent | ae014e189773f7299c12c1050334b3e8fe7b15d8 (diff) | |
download | gitlab-ce-25bd49e4f57fe15f9d61dc9376a5b7dc35b30f64.tar.gz |
Backport project template API to CE
Diffstat (limited to 'app/assets/javascripts/ide/stores')
-rw-r--r-- | app/assets/javascripts/ide/stores/modules/file_templates/actions.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/assets/javascripts/ide/stores/modules/file_templates/actions.js b/app/assets/javascripts/ide/stores/modules/file_templates/actions.js index cc9f6c8638c..b7090e09daf 100644 --- a/app/assets/javascripts/ide/stores/modules/file_templates/actions.js +++ b/app/assets/javascripts/ide/stores/modules/file_templates/actions.js @@ -23,12 +23,12 @@ export const receiveTemplateTypesError = ({ commit, dispatch }) => { export const receiveTemplateTypesSuccess = ({ commit }, templates) => commit(types.RECEIVE_TEMPLATE_TYPES_SUCCESS, templates); -export const fetchTemplateTypes = ({ dispatch, state }, page = 1) => { +export const fetchTemplateTypes = ({ dispatch, state, rootState }, page = 1) => { if (!Object.keys(state.selectedTemplateType).length) return Promise.reject(); dispatch('requestTemplateTypes'); - return Api.templates(state.selectedTemplateType.key, { page }) + return Api.projectTemplates(rootState.currentProjectId, state.selectedTemplateType.key, { page }) .then(({ data, headers }) => { const nextPage = parseInt(normalizeHeaders(headers)['X-NEXT-PAGE'], 10); @@ -74,12 +74,16 @@ export const receiveTemplateError = ({ dispatch }, template) => { ); }; -export const fetchTemplate = ({ dispatch, state }, template) => { +export const fetchTemplate = ({ dispatch, state, rootState }, template) => { if (template.content) { return dispatch('setFileTemplate', template); } - return Api.templates(`${state.selectedTemplateType.key}/${template.key || template.name}`) + return Api.projectTemplate( + rootState.currentProjectId, + state.selectedTemplateType.key, + template.key || template.name, + ) .then(({ data }) => { dispatch('setFileTemplate', data); }) |