| 
									
										
										
										
											2024-04-18 14:53:17 +02:00
										 |  |  | import {restGet, restPost, restDelete, restPatch, restPostFile} from '../restConsumer.js' | 
					
						
							| 
									
										
										
										
											2024-04-17 23:00:37 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | export async function deleteArticle(id){ | 
					
						
							|  |  |  |     await restDelete("/research/" + id) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | export async function patchArticle(id, data){ | 
					
						
							|  |  |  |     await restPatch("/research/" + id, data) | 
					
						
							| 
									
										
										
										
											2024-04-18 14:53:17 +02:00
										 |  |  | } | 
					
						
							|  |  |  | export async function uploadPdf(file){ | 
					
						
							|  |  |  |     const formData = new FormData(); | 
					
						
							|  |  |  |     formData.append("file", file[0]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return restPostFile("/upload/Research", formData); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | export async function uploadBibTex(file){ | 
					
						
							|  |  |  |     const formData = new FormData(); | 
					
						
							|  |  |  |     formData.append("file", file[0]); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return restPostFile("/upload/Research", formData); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export async function postResearch(data){ | 
					
						
							|  |  |  |     return restPost("/research", data) | 
					
						
							| 
									
										
										
										
											2024-04-18 16:47:25 +02:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-18 18:34:52 +02:00
										 |  |  | export async function fetchAllResearches(){ | 
					
						
							| 
									
										
										
										
											2024-04-18 16:47:25 +02:00
										 |  |  |     return restGet("/researches") | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export async function getFile(url){ | 
					
						
							|  |  |  |     const restURL = import.meta.env.VITE_CLYDE_MODE === 'container' ? "http://localhost:8000": import.meta.env.DEV ? "http://localhost:5173" : "https://clyde.herisson.ovh/api" | 
					
						
							| 
									
										
										
										
											2024-04-19 12:35:07 +02:00
										 |  |  |     await fetch(restURL + "/" + url, {method: "GET"}) | 
					
						
							| 
									
										
										
										
											2024-04-18 16:47:25 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2024-04-18 17:17:29 +02:00
										 |  |  | export async function addView(url){ | 
					
						
							| 
									
										
										
										
											2024-04-19 12:35:07 +02:00
										 |  |  |     return restPost("/addview/" + url) | 
					
						
							| 
									
										
										
										
											2024-04-18 17:17:29 +02:00
										 |  |  | } |