/
gnomdeployer
/
VUZPlus
Обзор
Документация
Войти
/
gnomdeployer
/
VUZPlus
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
client/src/api/discipline.api.ts
45 строк
1 KB
unwelcome
rework api, rework directions and digital departments to programms, fix applications
13 май 2025, 19:19
13 май 2025, 19:19
4818e0a
Код
Авторство
О чём код?
import axios from "axios"; import { DEVMODE, API, type ICreateDiscipline } from "@/helpers/constants"; import { GET_COOKIE } from "@/helpers/functions"; //GET //GET All disciplines by programmID export function API_GetAllDisciplinesByProgramm(programmID: number) { return new Promise((resolve, reject) => { axios.get(`${API}/discipline/program_id/${programmID}`) .then(response => { if(DEVMODE) console.log('Get all disciplines by programm success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Get all disciplines by programm error: ', err); reject(err); }); }); } //POST //POST Create discipline export function API_CreateDiscipline(discipline: ICreateDiscipline) { return new Promise((resolve, reject) => { axios.post(`${API}/auth/discipline`, discipline, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Create discipline success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Create discipline error: ', err); reject(err); }); }); } //PUT //DELETE