Skip to content
Snippets Groups Projects
Commit 8eaa39fb authored by Timothee P's avatar Timothee P :sunflower:
Browse files

use api endpoint to fetch project-types instead of getter

parent 030f3c51
No related branches found
No related tags found
No related merge requests found
......@@ -69,6 +69,20 @@ const projectAPI = {
}
},
async getProjectTypes( baseUrl ) {
const response = await axios.get(
`${baseUrl}project-types/`
);
if (
response.status === 200 &&
response.data
) {
return response.data;
} else {
return null;
}
},
async deleteProject(baseUrl, projectSlug) {
const response = await axios.delete(
`${baseUrl}projects/${projectSlug}/`
......
......@@ -32,8 +32,7 @@
{{ project.title }}
</router-link>
<p>{{ project.description }}</p>
<strong v-if="project.moderation">Projet modéré</strong>
<strong v-else>Projet non modéré</strong>
<strong>Projet {{ project.moderation ? '' : 'non' }} modéré</strong>
</div>
<div class="meta">
<span data-tooltip="Délai avant archivage">
......@@ -71,16 +70,31 @@
</template>
<script>
import { mapGetters } from 'vuex';
import projectAPI from '@/services/project-api';
export default {
name: 'ProjectTypeList',
data() {
return {
project_types: null,
};
},
computed: {
...mapGetters(['project_types']),
DJANGO_BASE_URL: function () {
return this.$store.state.configuration.VUE_APP_DJANGO_BASE;
},
API_BASE_URL() {
return this.$store.state.configuration.VUE_APP_DJANGO_API_BASE;
},
},
mounted() {
projectAPI.getProjectTypes(this.API_BASE_URL)
.then((data) => {
if (data) this.project_types = data;
});
},
methods: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment