Skip to content
Snippets Groups Projects
project-api.js 814 B
Newer Older
import axios from '@/axios-client.js';
import store from '../store'

const baseUrl = store.state.configuration.VUE_APP_DJANGO_API_BASE;

const projectAPI = {
  async getProjectSubscription({ projectSlug }) {
    const response = await axios.get(
      `${baseUrl}projects/${projectSlug}/subscription/`
    );
    if (
      response.status === 200 &&
      response.data
    ) {
      return response.data;
    } else {
      return null;
    }
  },

  async subscribeProject({ projectSlug, suscribe }) {
    const response = await axios.put(
      `${baseUrl}projects/${projectSlug}/subscription/`,
      { is_suscriber: suscribe }
    );
    if (
      response.status === 200 &&
      response.data
    ) {
      return response.data;
    } else {
      return null;
    }
  },
}

export default projectAPI;