-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
713 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import axios from "axios"; | ||
import { | ||
ASK_FOR_OPINION_ROUTE, | ||
IDENTIFICATION_DUMMY_ROUTE, | ||
IDENTIFICATION_FEEDBACK_ROUTE, | ||
TUTORIAL_FEEDBACK_ROUTE, | ||
UPLOAD_PHOTO_FOR_DETECTION_ROUTE, | ||
} from "./api-routes"; | ||
|
||
export const uploadPhotoForDetection = async (file: File) => { | ||
const fd = new FormData(); | ||
fd.append("image", file, file.name); | ||
fd.append("date", "" + Date.now() / 1000); // date.now gives in milliseconds, convert to seconds | ||
|
||
const { data } = await axios.post(UPLOAD_PHOTO_FOR_DETECTION_ROUTE, fd); | ||
return data; | ||
}; | ||
|
||
export const sendTutorialFeedback = async (feedback: any) => { | ||
const { data } = await axios.post(TUTORIAL_FEEDBACK_ROUTE, feedback); | ||
return data; | ||
}; | ||
|
||
export const sendIdentificationFeedback = async (feedbackData: any) => { | ||
const { data } = await axios.post( | ||
IDENTIFICATION_FEEDBACK_ROUTE, | ||
feedbackData, | ||
); | ||
return data; | ||
}; | ||
|
||
export const sendIdentificationDummyFeedback = async (feedbackDummy: any) => { | ||
const { data } = await axios.post(IDENTIFICATION_DUMMY_ROUTE, feedbackDummy); | ||
return data; | ||
}; | ||
|
||
export const sendExpertiseForm = async (feedbackExpert: any) => { | ||
const { data } = await axios.post(ASK_FOR_OPINION_ROUTE, feedbackExpert, { | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}); | ||
return data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const UPLOAD_PHOTO_FOR_DETECTION_ROUTE = "/upload"; | ||
export const TUTORIAL_FEEDBACK_ROUTE = "/tutorial-feedback"; | ||
export const IDENTIFICATION_FEEDBACK_ROUTE = "/identification-feedback"; | ||
export const IDENTIFICATION_DUMMY_ROUTE = "/identification-dummy"; | ||
export const ASK_FOR_OPINION_ROUTE = "http://localhost:8000/api/requests/"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.