summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/repo/services/index.js
blob: 57c234cd4c96023293ae85842f125f66a68098ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import Vue from 'vue';
import VueResource from 'vue-resource';
import Api from '../../api';

Vue.use(VueResource);

export default {
  getTreeData(endpoint) {
    return Vue.http.get(endpoint, { params: { format: 'json' } });
  },
  getFileData(endpoint) {
    return Vue.http.get(endpoint, { params: { format: 'json' } });
  },
  getRawFileData(endpoint) {
    return Vue.http.get(endpoint);
  },
  getBranchData(projectId, currentBranch) {
    return Api.branchSingle(projectId, currentBranch);
  },
  createBranch(projectId, payload) {
    const url = Api.buildUrl(Api.createBranchPath).replace(':id', projectId);

    return Vue.http.post(url, payload);
  },
  commit(projectId, payload) {
    return Api.commitMultiple(projectId, payload);
  },
};