Skip to content

Commit 060d7e2

Browse files
committed
update
1 parent cddcfcc commit 060d7e2

2 files changed

Lines changed: 3 additions & 22 deletions

File tree

backend/.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ AUTH_URI=https://accounts.google.com/o/oauth2/auth
88
TOKEN_URI=https://oauth2.googleapis.com/token
99
AUTH_PROVIDER_CERT_URL=https://www.googleapis.com/oauth2/v1/certs
1010
CLIENT_CERT_URL=https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-fbsvc%40sap-checklist.iam.gserviceaccount.com
11-
UNIVERSE_DOMAIN=googleapis.com
11+
UNIVERSE_DOMAIN=googleapis.com
12+
DB_URL=mongodb+srv://akileshsampath1404:akileshdb123456@sap-checklist-database.jfltzs9.mongodb.net/sap-checklist-app?retryWrites=true&w=majority&appName=Cluster0

frontend/src/pages/Admin/EditTask/EditTask.jsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React, { useState, useEffect } from "react";
22
import { useApi } from "../../../context/ApiContext";
33
import { useNavigate, useLocation } from "react-router-dom";
4-
import {getRequest} from '../../../utils/ApiService'
54
import './EditTask.css'
65

76

87
export default function EditTask() {
98
const navigate = useNavigate();
109
const location = useLocation();
11-
const { editTask, admin } = useApi();
10+
const { editTask, users } = useApi();
1211

1312
// Get task from location state
1413
const task = location.state?.task;
@@ -19,7 +18,6 @@ export default function EditTask() {
1918
const [days, setDays] = useState([]);
2019
const [dates, setDates] = useState("");
2120
const [assignedUsers, setAssignedUsers] = useState([]);
22-
const [users, setUsers] = useState([]);
2321

2422
const dayOptions = [
2523
"Sunday",
@@ -32,7 +30,6 @@ export default function EditTask() {
3230
];
3331

3432
useEffect(() => {
35-
// If no task in location.state, redirect back or handle error
3633
if (!task) {
3734
alert("No task data found");
3835
navigate("/admin/tasks");
@@ -53,23 +50,7 @@ export default function EditTask() {
5350
}
5451
}, [task, navigate]);
5552

56-
// Fetch users for assigning
57-
useEffect(() => {
58-
const fetchUsers = async () => {
59-
try {
60-
const response = await getRequest(
61-
"http://localhost:3000/api/user/get-all-users",
62-
{},
63-
{ admin_uid: admin.uid }
64-
);
65-
setUsers(response.users);
66-
} catch (err) {
67-
console.error(err);
68-
}
69-
};
7053

71-
fetchUsers();
72-
}, []);
7354

7455
const toggleDay = (day) => {
7556
setDays((prev) =>
@@ -131,7 +112,6 @@ export default function EditTask() {
131112
className="form-check-input"
132113
type="checkbox"
133114
id="select-all-users"
134-
required
135115
checked={assignedUsers.length === users.length && users.length > 0}
136116
onChange={(e) => {
137117
if (e.target.checked) {

0 commit comments

Comments
 (0)