Skip to content

Commit

Permalink
Merge pull request #64 from deepali-chavhan/develop
Browse files Browse the repository at this point in the history
TaskId #226755 fix: Integrate Edit API & remove some input fields
  • Loading branch information
ankush-maherwal authored Sep 12, 2024
2 parents 9062a37 + 6a2869f commit 87a8987
Show file tree
Hide file tree
Showing 5 changed files with 340 additions and 212 deletions.
15 changes: 9 additions & 6 deletions packages/admin/src/api/studentAPI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ const studentAPI = async (data) => {
};

const jsonData = {
name: data.firstName,
username: "",
name: data.name,
username:data.username ? data.username: "",
email: data.email,
mobile: data.mobile,
gender: data.gender,
dateOfBirth: data.dob,
dateOfBirth: data.dateOfBirth,
board: data.board,
password: data.password,
status: "true",
// status: "true",
className: data.group,
groups: [],
religion: data.religion,
Expand All @@ -36,8 +36,11 @@ const studentAPI = async (data) => {
fatherEducation: data.fatherEducation,
motherOccupation: data.motherOccupation,
fatherOccupation: data.fatherOccupation,
noOfSiblings: data.siblings,
studentEnrollId: data.studentEnrollId,
noOfSiblings: data.noOfSiblings,
motherName : data.motherName,
fatherName : data.fatherName,
medium : data.medium
// studentEnrollId: data.studentEnrollId,
};

let result;
Expand Down
67 changes: 67 additions & 0 deletions packages/admin/src/api/studentUpdateAPI.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import axios from "axios";
import { studentRegister } from "../routes/links";

const studentUpdateAPI = async (data) => {
const token = sessionStorage.getItem("token");

const schoolUdise = data.udise.split(",");

// Extracting the udise value in separate variable
const udiseCode = schoolUdise[0];

const headers = {
"Accept-Language": "en-GB,en;q=0.9",
Authorization: `Bearer ${token}`,
Connection: "keep-alive",
"Content-Type": "application/json",
};

const jsonData = {
name: data.name,
username:data.username ? data.username: "",
email: data.email,
mobile: data.mobile,
gender: data.gender,
dateOfBirth: data.dateOfBirth,
board: data.board,
// status: "true",
className: data.group,
groups: [],
religion: data.religion,
schoolUdise: udiseCode,
caste: data.caste,
annualIncome: data.annualIncome,
motherEducation: data.motherEducation,
fatherEducation: data.fatherEducation,
motherOccupation: data.motherOccupation,
fatherOccupation: data.fatherOccupation,
noOfSiblings: data.noOfSiblings,
motherName : data.motherName,
fatherName : data.fatherName,
medium : data.medium
// studentEnrollId: data.studentEnrollId,
};

let result;
await axios({
method: "PUT",
url: studentRegister +"/"+ data.userId,
data: jsonData,
headers: headers,
})
.then((res) => {
if (res.data && res.data.errorCode) {
result = false;
} else {
result = true;
}
})
.catch(function (error) {
let err = 0;
return err;
});

return result;
};

export default studentUpdateAPI;
Loading

0 comments on commit 87a8987

Please sign in to comment.