Skip to content

Commit

Permalink
Merge pull request #5 from Akash2377/update
Browse files Browse the repository at this point in the history
updated  json server link
  • Loading branch information
Akash2377 authored Dec 3, 2022
2 parents 05be488 + d91cee1 commit cdda9a9
Show file tree
Hide file tree
Showing 17 changed files with 77 additions and 104 deletions.
10 changes: 3 additions & 7 deletions Assist/js/Admin/Myaccount.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Changepage() {
fetchAllCoursesData();
async function fetchAllCoursesData() {
try {
let res = await fetch("https://jesonserverforzee5.herokuapp.com/courses");
let res = await fetch("https://jesonserver.onrender.com/courses");
let data = await res.json();
showMyCourses(data);
} catch (error) {
Expand Down Expand Up @@ -61,9 +61,7 @@ async function WatchLecturesinWindow(index) {
document.getElementById("MyCourses").style.display = "none";
document.getElementById("WatchLectures").style.display = "block";
try {
let res = await fetch(
`https://jesonserverforzee5.herokuapp.com/courses/${index}`
);
let res = await fetch(`https://jesonserver.onrender.com/courses/${index}`);
let data = await res.json();
showAllLectures(data);
} catch (error) {
Expand All @@ -90,9 +88,7 @@ function showAllLectures(data) {
async function WatchLectureOnYoutube(index, urlkey) {
localStorage.setItem("urlKEy", urlkey);
try {
let res = await fetch(
`https://jesonserverforzee5.herokuapp.com/courses/${index}`
);
let res = await fetch(`https://jesonserver.onrender.com/courses/${index}`);
let data = await res.json();
showOnScreen(data.lectures);
} catch (error) {
Expand Down
14 changes: 6 additions & 8 deletions Assist/js/Admin/addLecture.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function checkLoginStatus() {
selectTagoption();
async function selectTagoption() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/courses";
let url = "https://jesonserver.onrender.com/courses";
let res = await fetch(url);
let data = await res.json();
addSelectTagOption(data);
Expand Down Expand Up @@ -50,7 +50,7 @@ function AddStudentInClass(event) {
async function getDataFromServer() {
try {
let idO = document.getElementById("CRCName").value;
let url = `https://jesonserverforzee5.herokuapp.com/courses/${idO}`;
let url = `https://jesonserver.onrender.com/courses/${idO}`;
let res = await fetch(url);
let data = await res.json();

Expand All @@ -68,7 +68,7 @@ function check(data) {
id: Date.now(),
};
data.push(obj);
fetch(`https://jesonserverforzee5.herokuapp.com/courses/${idO}`, {
fetch(`https://jesonserver.onrender.com/courses/${idO}`, {
method: "PATCH",
body: JSON.stringify({
lectures: data,
Expand All @@ -80,7 +80,7 @@ function check(data) {
showDataInTable();
async function showDataInTable() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/courses";
let url = "https://jesonserver.onrender.com/courses";
let res = await fetch(url);
let data = await res.json();
displayDataInTable(data);
Expand All @@ -107,13 +107,11 @@ function displayDataInTable(data) {
}
async function deleteSTD(index, ind2) {
try {
let res = await fetch(
`https://jesonserverforzee5.herokuapp.com/courses/${index}`
);
let res = await fetch(`https://jesonserver.onrender.com/courses/${index}`);
let data = await res.json();
let arr = data.lectures;
arr.splice(ind2, 1);
fetch(`https://jesonserverforzee5.herokuapp.com/courses/${index}`, {
fetch(`https://jesonserver.onrender.com/courses/${index}`, {
method: "PATCH",
body: JSON.stringify({
lectures: arr,
Expand Down
8 changes: 3 additions & 5 deletions Assist/js/Admin/changePSA.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function submitData(event) {
getDataFromServer();
async function getDataFromServer() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/adminLoginData";
let url = "https://jesonserver.onrender.com/adminLoginData";
let res = await fetch(url);
let data = await res.json();
check(data);
Expand Down Expand Up @@ -54,9 +54,7 @@ function myFunction() {
async function pointOutAdmin() {
let keyUser = localStorage.getItem("KeyOfLogin");
try {
let res = await fetch(
"https://jesonserverforzee5.herokuapp.com/adminLoginData"
);
let res = await fetch("https://jesonserver.onrender.com/adminLoginData");
let data = await res.json();
let index = 1;
for (var i = 0; i < data.length; i++) {
Expand All @@ -71,7 +69,7 @@ async function pointOutAdmin() {
}

function upadtePassInServer(index) {
fetch(`https://jesonserverforzee5.herokuapp.com/adminLoginData/${index}`, {
fetch(`https://jesonserver.onrender.com/adminLoginData/${index}`, {
method: "PATCH",
body: JSON.stringify({
password: document.getElementById("CNewPass").value,
Expand Down
8 changes: 4 additions & 4 deletions Assist/js/Admin/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function AddStudentInClass(event) {
getDataFromServer();
async function getDataFromServer() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/studentLoginData";
let url = "https://jesonserver.onrender.com/studentLoginData";
let res = await fetch(url);
let data = await res.json();
check(data);
Expand All @@ -48,7 +48,7 @@ function check(data) {
if (flag.length != 0) {
alert("Student is already in the classroom");
} else {
fetch("https://jesonserverforzee5.herokuapp.com/studentLoginData", {
fetch("https://jesonserver.onrender.com/studentLoginData", {
method: "POST",
body: JSON.stringify({
name: document.getElementById("StudName").value,
Expand All @@ -68,7 +68,7 @@ function check(data) {
showDataInTable();
async function showDataInTable() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/studentLoginData";
let url = "https://jesonserver.onrender.com/studentLoginData";
let res = await fetch(url);
let data = await res.json();
displayDataInTable(data);
Expand All @@ -95,7 +95,7 @@ function displayDataInTable(data) {
}

function deleteSTD(index) {
fetch(`https://jesonserverforzee5.herokuapp.com/studentLoginData/${index}`, {
fetch(`https://jesonserver.onrender.com/studentLoginData/${index}`, {
method: "DELETE",
body: JSON.stringify({}),
headers: {
Expand Down
8 changes: 3 additions & 5 deletions Assist/js/Admin/profileS.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Changepage() {
getDataFromServer();
async function getDataFromServer() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/adminLoginData";
let url = "https://jesonserver.onrender.com/adminLoginData";
let res = await fetch(url);
let data = await res.json();
ShowDataOnProfile(data);
Expand Down Expand Up @@ -50,9 +50,7 @@ async function pointOutAdmin(event) {
event.preventDefault();
let keyUser = localStorage.getItem("KeyOfLogin");
try {
let res = await fetch(
"https://jesonserverforzee5.herokuapp.com/adminLoginData"
);
let res = await fetch("https://jesonserver.onrender.com/adminLoginData");
let data = await res.json();
let index = 1;
for (var i = 0; i < data.length; i++) {
Expand All @@ -66,7 +64,7 @@ async function pointOutAdmin(event) {
}
}
function UpdateSA(index) {
fetch(`https://jesonserverforzee5.herokuapp.com/adminLoginData/${index}`, {
fetch(`https://jesonserver.onrender.com/adminLoginData/${index}`, {
method: "PATCH",
body: JSON.stringify({
name: document.getElementById("nameSA").value,
Expand Down
14 changes: 6 additions & 8 deletions Assist/js/SuperAdmin/addLecture.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function checkLoginStatus() {
selectTagoption();
async function selectTagoption() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/courses";
let url = "https://jesonserver.onrender.com/courses";
let res = await fetch(url);
let data = await res.json();
addSelectTagOption(data);
Expand Down Expand Up @@ -50,7 +50,7 @@ function AddStudentInClass(event) {
async function getDataFromServer() {
try {
let idO = document.getElementById("CRCName").value;
let url = `https://jesonserverforzee5.herokuapp.com/courses/${idO}`;
let url = `https://jesonserver.onrender.com/courses/${idO}`;
let res = await fetch(url);
let data = await res.json();

Expand All @@ -68,7 +68,7 @@ function check(data) {
id: Date.now(),
};
data.push(obj);
fetch(`https://jesonserverforzee5.herokuapp.com/courses/${idO}`, {
fetch(`https://jesonserver.onrender.com/courses/${idO}`, {
method: "PATCH",
body: JSON.stringify({
lectures: data,
Expand All @@ -80,7 +80,7 @@ function check(data) {
showDataInTable();
async function showDataInTable() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/courses";
let url = "https://jesonserver.onrender.com/courses";
let res = await fetch(url);
let data = await res.json();
displayDataInTable(data);
Expand All @@ -107,13 +107,11 @@ function displayDataInTable(data) {
}
async function deleteSTD(index, ind2) {
try {
let res = await fetch(
`https://jesonserverforzee5.herokuapp.com/courses/${index}`
);
let res = await fetch(`https://jesonserver.onrender.com/courses/${index}`);
let data = await res.json();
let arr = data.lectures;
arr.splice(ind2, 1);
fetch(`https://jesonserverforzee5.herokuapp.com/courses/${index}`, {
fetch(`https://jesonserver.onrender.com/courses/${index}`, {
method: "PATCH",
body: JSON.stringify({
lectures: arr,
Expand Down
4 changes: 2 additions & 2 deletions Assist/js/SuperAdmin/changePSA.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function submitData(event) {
getDataFromServer();
async function getDataFromServer() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/superAdminLoginData";
let url = "https://jesonserver.onrender.com/superAdminLoginData";
let res = await fetch(url);
let data = await res.json();
check(data);
Expand Down Expand Up @@ -53,7 +53,7 @@ function myFunction() {
}

function upadtePassInServer() {
fetch(" https://jesonserverforzee5.herokuapp.com/superAdminLoginData/1", {
fetch(" https://jesonserver.onrender.com/superAdminLoginData/1", {
method: "PATCH",
body: JSON.stringify({
password: document.getElementById("CNewPass").value,
Expand Down
8 changes: 4 additions & 4 deletions Assist/js/SuperAdmin/createCourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function AddStudentInClass(event) {
getDataFromServer();
async function getDataFromServer() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/courses";
let url = "https://jesonserver.onrender.com/courses";
let res = await fetch(url);
let data = await res.json();
check(data);
Expand All @@ -47,7 +47,7 @@ function check(data) {
if (flag.length != 0) {
alert("Course is already Available");
} else {
fetch("https://jesonserverforzee5.herokuapp.com/courses", {
fetch("https://jesonserver.onrender.com/courses", {
method: "POST",
body: JSON.stringify({
name: document.getElementById("CRCName").value,
Expand All @@ -68,7 +68,7 @@ function check(data) {
showDataInTable();
async function showDataInTable() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/courses";
let url = "https://jesonserver.onrender.com/courses";
let res = await fetch(url);
let data = await res.json();
displayDataInTable(data);
Expand All @@ -95,7 +95,7 @@ function displayDataInTable(data) {
});
}
function deleteSTD(index) {
fetch(`https://jesonserverforzee5.herokuapp.com/courses/${index}`, {
fetch(`https://jesonserver.onrender.com/courses/${index}`, {
method: "DELETE",
body: JSON.stringify({}),
headers: {
Expand Down
31 changes: 14 additions & 17 deletions Assist/js/SuperAdmin/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ function AddStudentInClass(event) {
async function getDataFromServer() {
try {
if (flagcheck == "Add New Admin") {
let url = "https://jesonserverforzee5.herokuapp.com/adminLoginData";
let url = "https://jesonserver.onrender.com/adminLoginData";
let res = await fetch(url);
let data = await res.json();
check(data);
} else {
let url = "https://jesonserverforzee5.herokuapp.com/studentLoginData";
let url = "https://jesonserver.onrender.com/studentLoginData";
let res = await fetch(url);
let data = await res.json();
check(data);
Expand Down Expand Up @@ -64,7 +64,7 @@ function check(data) {
}
} else {
if (flagcheck == "Add New Admin") {
fetch("https://jesonserverforzee5.herokuapp.com/adminLoginData", {
fetch("https://jesonserver.onrender.com/adminLoginData", {
method: "POST",
body: JSON.stringify({
name: document.getElementById("StudName").value,
Expand All @@ -79,7 +79,7 @@ function check(data) {
headers: { "Content-Type": "application/json" },
});
} else {
fetch("https://jesonserverforzee5.herokuapp.com/studentLoginData", {
fetch("https://jesonserver.onrender.com/studentLoginData", {
method: "POST",
body: JSON.stringify({
name: document.getElementById("StudName").value,
Expand All @@ -101,12 +101,12 @@ showDataInTable();
async function showDataInTable() {
try {
if (flagcheck == "Add New Admin") {
let url = "https://jesonserverforzee5.herokuapp.com/adminLoginData";
let url = "https://jesonserver.onrender.com/adminLoginData";
let res = await fetch(url);
let data = await res.json();
displayDataInTable(data);
} else {
let url = "https://jesonserverforzee5.herokuapp.com/studentLoginData";
let url = "https://jesonserver.onrender.com/studentLoginData";
let res = await fetch(url);
let data = await res.json();
displayDataInTable(data);
Expand Down Expand Up @@ -152,7 +152,7 @@ function displayDataInTable(data) {
}
function deleteSTD(index) {
if (flagcheck == "Add New Admin") {
fetch(`https://jesonserverforzee5.herokuapp.com/adminLoginData/${index}`, {
fetch(`https://jesonserver.onrender.com/adminLoginData/${index}`, {
method: "DELETE",
body: JSON.stringify({}),
headers: {
Expand All @@ -161,16 +161,13 @@ function deleteSTD(index) {
});
showDataInTable();
} else {
fetch(
`https://jesonserverforzee5.herokuapp.com/studentLoginData/${index}`,
{
method: "DELETE",
body: JSON.stringify({}),
headers: {
"Content-Type": "application/json",
},
}
);
fetch(`https://jesonserver.onrender.com/studentLoginData/${index}`, {
method: "DELETE",
body: JSON.stringify({}),
headers: {
"Content-Type": "application/json",
},
});
showDataInTable();
}
}
2 changes: 1 addition & 1 deletion Assist/js/SuperAdmin/myAccount.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
fetchAllCoursesData();
async function fetchAllCoursesData() {
try {
let res = await fetch("https://jesonserverforzee5.herokuapp.com/courses");
let res = await fetch("https://jesonserver.onrender.com/courses");
let data = await res.json();

showAllCourses(data);
Expand Down
4 changes: 2 additions & 2 deletions Assist/js/SuperAdmin/profileS.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Changepage() {
getDataFromServer();
async function getDataFromServer() {
try {
let url = "https://jesonserverforzee5.herokuapp.com/superAdminLoginData";
let url = "https://jesonserver.onrender.com/superAdminLoginData";
let res = await fetch(url);
let data = await res.json();
ShowDataOnProfile(data);
Expand All @@ -46,7 +46,7 @@ function ShowDataOnProfile(data) {
document.getElementById("UpdateSAform").addEventListener("submit", UpdateSA);
function UpdateSA(event) {
event.preventDefault();
fetch(" https://jesonserverforzee5.herokuapp.com/superAdminLoginData/1", {
fetch(" https://jesonserver.onrender.com/superAdminLoginData/1", {
method: "PATCH",
body: JSON.stringify({
name: document.getElementById("nameSA").value,
Expand Down
2 changes: 1 addition & 1 deletion Assist/js/studentLogin&signup/payment.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function PaymentProcess(event) {
}

function buyTheCourse(index) {
fetch(`https://jesonserverforzee5.herokuapp.com/courses/${index}`, {
fetch(`https://jesonserver.onrender.com/courses/${index}`, {
method: "PATCH",
body: JSON.stringify({
myCourse: true,
Expand Down
Loading

0 comments on commit cdda9a9

Please sign in to comment.