mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-30 18:00:56 +01:00
optimized project
This commit is contained in:
@@ -2,7 +2,8 @@ import request from '../../api/request'
|
||||
|
||||
const state = {
|
||||
projectForm: {},
|
||||
projectList: []
|
||||
projectList: [],
|
||||
projectTags: []
|
||||
}
|
||||
|
||||
const getters = {}
|
||||
@@ -13,12 +14,15 @@ const mutations = {
|
||||
},
|
||||
SET_PROJECT_LIST: (state, value) => {
|
||||
state.projectList = value
|
||||
},
|
||||
SET_PROJECT_TAGS: (state, value) => {
|
||||
state.projectTags = value
|
||||
}
|
||||
}
|
||||
|
||||
const actions = {
|
||||
getProjectList ({ state, commit }) {
|
||||
request.get('/projects')
|
||||
getProjectList ({ state, commit }, payload) {
|
||||
request.get('/projects', payload)
|
||||
.then(response => {
|
||||
if (response.data.data) {
|
||||
commit('SET_PROJECT_LIST', response.data.data.map(d => {
|
||||
@@ -28,6 +32,14 @@ const actions = {
|
||||
}
|
||||
})
|
||||
},
|
||||
getProjectTags ({ state, commit }) {
|
||||
request.get('/projects/tags')
|
||||
.then(response => {
|
||||
if (response.data.data) {
|
||||
commit('SET_PROJECT_TAGS', response.data.data.map(d => d.tag))
|
||||
}
|
||||
})
|
||||
},
|
||||
addProject ({ state }) {
|
||||
request.put('/projects', state.projectForm)
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user