-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Student details based on UDISE api and button chamges added
- Loading branch information
1 parent
3b14db4
commit d7729b6
Showing
2 changed files
with
90 additions
and
0 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,33 @@ | ||
import axios from "axios"; | ||
import { studentSearch } from "../routes/links"; | ||
const studentUdiseAPI = async (person) => { | ||
const token = sessionStorage.getItem("token"); | ||
console.log("INSIDE API CALL"); | ||
console.log(person); | ||
|
||
const apiUrl = studentSearch; | ||
const headers = { | ||
Accept: "*/*", | ||
Authorization: `Bearer ${token}`, | ||
"Content-Type": "application/json", | ||
}; | ||
|
||
const requestData = { | ||
limit: "", | ||
page: 0, | ||
filters: { schoolUdise: { eq: person } }, | ||
}; | ||
|
||
try { | ||
const response = await axios.post(apiUrl, requestData, { headers }); | ||
console.log("INSIDE API CALL 2"); | ||
console.log(response); | ||
return response; // Return the response here | ||
} catch (error) { | ||
// Handle any errors here | ||
console.error("Error fetching data:", error); | ||
return null; // Return null or an error object in case of an error | ||
} | ||
}; | ||
|
||
export default studentUdiseAPI; |
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