/
gnomdeployer
/
VUZPlus
Обзор
Документация
Войти
/
gnomdeployer
/
VUZPlus
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
master
client/src/api/applications.api.ts
144 строки
5 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 ICreateApplicationUniversityForStudents } from "@/helpers/constants"; import { GET_COOKIE } from "@/helpers/functions"; //GET// //GET incoming exchange student applications export function API_GetAllIncomingStudentApplications() { return new Promise((resolve, reject) => { axios.get(`${API}/auth/application/ingoing/student`, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Get incoming student applications success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Get incoming student applications error: ', err); reject(err); }); }); } //GET incoming exchange university applications export function API_GetAllIncomingUniversityApplications() { return new Promise((resolve, reject) => { axios.get(`${API}/auth/application/ingoing/university`, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Get incoming university applications success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Get incoming university applications error: ', err); reject(err); }); }); } //GET outgoing exchange student applications export function API_GetAllOutgoingStudentApplications() { return new Promise((resolve, reject) => { axios.get(`${API}/auth/application/outgoing/student`, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Get outgoing student applications success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Get outgoing student applications error: ', err); reject(err); }); }); } //GET outgoing exchange university applications export function API_GetAllOutgoingUniversityApplications() { return new Promise((resolve, reject) => { axios.get(`${API}/auth/application/outgoing/university`, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Get outgoing university applications success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Get outgoing university applications error: ', err); reject(err); }); }); } //POST// //POST Create exchange application by student export function API_CreateExchangeApplicationByStudent(universityID: number, programmID: number) { return new Promise((resolve, reject) => { axios.post(`${API}/auth/application/student?target_university_id=${universityID}&program_id=${programmID}`, null, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Create exchange application by student success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Create exchange application by student error: ', err); reject(err); }); }); } //POST Create exchange application by delegate export function API_CreateExchangeApplicationByDelegate(body: ICreateApplicationUniversityForStudents) { return new Promise((resolve, reject) => { axios.post(`${API}/auth/application/delegate`, body, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Create exchange application by delegate success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Create exchange application by delegate error: ', err); reject(err); }); }); } //PUT// //PUT Update exchange application status export function API_UpdateExchangeApplicationStatus(applicationID: number, applicationStatus: string) { return new Promise((resolve, reject) => { axios.put(`${API}/auth/application/status?application_id=${applicationID}&status=${applicationStatus}`, null, { headers: { Authorization: `Bearer ${GET_COOKIE('access_token')}`, } }) .then(response => { if(DEVMODE) console.log('Update exchange application sstatus success: ', response); resolve(response); }) .catch(err => { if(DEVMODE) console.log('Update exchange application sstatus error: ', err); reject(err); }); }); } //DELETE//