Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
raggettii committed Dec 15, 2024
1 parent a957eb6 commit 43c5ca3
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/screens/UserPortal/LeaveOrganization/LeaveOrganization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,23 @@ const LeaveOrganization = (): JSX.Element => {
const navigate = useNavigate();
const { orgId: organizationId } = useParams();

const userEmail = getItem('Talawa-admin', '_email');
const userId = getItem('Talawa-admin', '_userId');
const userEmail = getItem('Talawa-admin', 'email');
const userId = getItem('Talawa-admin', 'userId');

// console.log(`here is email -${userEmail}-`)

// console.log(`here is user id -${userId}-`)

const [email, setEmail] = useState('');
const [error, setError] = useState('');
const [loading, setLoading] = useState(false);
const [showModal, setShowModal] = useState(false);
const [verificationStep, setVerificationStep] = useState(false);

const trimmedUserId = JSON.parse(userId)?.trim();
// console.log(`email from input -${email}-`)
// const trimmedUserId = JSON.parse(userId)?.trim();

// console.log(`here is trimmed user id ${trimmedUserId}`)

const {
data: orgData,
Expand All @@ -46,15 +53,17 @@ const LeaveOrganization = (): JSX.Element => {
setError('');
setLoading(true);
removeMember({
variables: { orgid: organizationId, userid: trimmedUserId },
variables: { orgid: organizationId, userid: userId },
});
};

const handleVerifyAndLeave = (): void => {
const trimmedEmail = email.trim();
const trimmedUserEmail = JSON.parse(userEmail)?.trim();
// const trimmedEmail = email.trim();
// console.log(`here is trimmed email from input ${trimmedEmail}`)
// const trimmedUserEmail = JSON.parse(userEmail)?.trim();
// console.log(`here is trimmed email from local storage ${trimmedUserEmail}`)

if (trimmedEmail === trimmedUserEmail) {
if (email === userEmail) {
handleLeaveOrganization();
} else {
setError('Verification failed: Email does not match.');
Expand Down

0 comments on commit 43c5ca3

Please sign in to comment.