28 lines
686 B
JavaScript
28 lines
686 B
JavaScript
|
|
import axios from 'axios'
|
||
|
|
|
||
|
|
const API_BASE = '/api'
|
||
|
|
|
||
|
|
export async function getProjects() {
|
||
|
|
const response = await axios.get(`${API_BASE}/projects/`)
|
||
|
|
return response.data
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function createProject(data) {
|
||
|
|
const response = await axios.post(`${API_BASE}/projects/`, data)
|
||
|
|
return response.data
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function getProject(id) {
|
||
|
|
const response = await axios.get(`${API_BASE}/projects/${id}/`)
|
||
|
|
return response.data
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function updateProject(id, data) {
|
||
|
|
const response = await axios.put(`${API_BASE}/projects/${id}/`, data)
|
||
|
|
return response.data
|
||
|
|
}
|
||
|
|
|
||
|
|
export async function deleteProject(id) {
|
||
|
|
await axios.delete(`${API_BASE}/projects/${id}/`)
|
||
|
|
}
|