-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
edfb73c
commit 60a1941
Showing
82 changed files
with
3,660 additions
and
819 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
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 |
---|---|---|
@@ -1,30 +1,26 @@ | ||
import React, { useEffect } from 'react'; | ||
import { useParams, Redirect } from 'react-router-dom'; | ||
import React, { useEffect } from "react"; | ||
import { useParams } from "react-router-dom"; | ||
import jwtDecode from "jwt-decode"; | ||
import {verifyLearner} from "../Services/Learner" | ||
import { verifyLearner } from "../Services/Learner"; | ||
import Spinner from "../UIHandlers/Spinner.js"; | ||
|
||
function VerifyEmail() { | ||
const {token} = useParams(); | ||
useEffect(() => { | ||
async function verify(){ | ||
localStorage.setItem("token", token); | ||
const res = await verifyLearner(jwtDecode(token)._id); | ||
const { token } = useParams(); | ||
useEffect(() => { | ||
async function verify() { | ||
localStorage.setItem("token", token); | ||
const res = await verifyLearner(jwtDecode(token)._id); | ||
|
||
window.location = "/" | ||
}; | ||
try{ | ||
verify() | ||
} | ||
catch(err){ | ||
alert(err) | ||
} | ||
}, []); | ||
window.location = "/"; | ||
} | ||
try { | ||
verify(); | ||
} catch (err) { | ||
alert(err); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<h3 className="card-header">Verify Email</h3> | ||
</div> | ||
) | ||
return <Spinner open={true} setOpen={() => console.log("Spinner")} />; | ||
} | ||
|
||
export default VerifyEmail; | ||
export default VerifyEmail; |
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
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 |
---|---|---|
@@ -1,22 +1,29 @@ | ||
import * as Yup from "yup"; | ||
import {addSubCat} from "../../Services/AddCatAndSubCat"; | ||
import { addSubCat } from "../../Services/AddCatAndSubCat"; | ||
|
||
export const subCategories = { | ||
name: [""], | ||
name: "", | ||
description: "", | ||
}; | ||
|
||
export const validationSchema = Yup.object({ | ||
name: Yup.array() | ||
.of( | ||
Yup.string() | ||
.min(2, "Every Field must contain 2 characters or more ") | ||
.max(30, "Every Field must contain 30 characters or less ") | ||
.required("No Field should be empty ") | ||
) | ||
.required(), | ||
name: Yup.string() | ||
.min(2, "Name must contain 2 characters or more ") | ||
.max(30, "Name must contain 30 characters or less ") | ||
.required("Name shouldn't be empty "), | ||
description: Yup.string() | ||
.min(30, "Description must contain 30 characters or more") | ||
.max(100, "Description must contain 100 characters or less") | ||
.required("Description is required"), | ||
}); | ||
|
||
export const handleSubmit = (values, subCategories, setSubCategories) => { | ||
addSubCat(values, subCategories, setSubCategories) | ||
export const handleSubmit = ( | ||
values, | ||
subCategories, | ||
setSubCategories, | ||
resetForm, | ||
setOpen | ||
) => { | ||
console.log(values); | ||
addSubCat(values, subCategories, setSubCategories, resetForm, setOpen); | ||
}; | ||
|
Oops, something went wrong.