From 8ba07f5c074f6c406f0084bb7ebf5eac3e0776a4 Mon Sep 17 00:00:00 2001 From: wrzesinski-hubert Date: Thu, 10 Dec 2020 21:51:01 +0100 Subject: [PATCH] ... --- src/components/CourseCard.tsx | 1 - src/components/Rightbar.tsx | 4 ++-- src/contexts/CASProvider.tsx | 10 +++++----- src/contexts/CoursesProvider.tsx | 7 +++---- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/components/CourseCard.tsx b/src/components/CourseCard.tsx index a381f29..2be713f 100644 --- a/src/components/CourseCard.tsx +++ b/src/components/CourseCard.tsx @@ -205,7 +205,6 @@ export const CourseCard = ({ course }: CourseCardProps) => { {group.lecturer.replace('UAM', '')} )} - {console.log("abisfdibuafsbuiafsbuifasbuibuiafsbuifasbuifsabuiasf",group)} {createClassTime(group.time)[0] + " - " + createClassTime(group.time)[1]} {/* Sala: {group.room} */} diff --git a/src/components/Rightbar.tsx b/src/components/Rightbar.tsx index 05c2cc3..eb82fe1 100644 --- a/src/components/Rightbar.tsx +++ b/src/components/Rightbar.tsx @@ -48,10 +48,10 @@ const SaveButton = styled.div` `; export const Rightbar = () => { - const { selectBasketCourses, saveBasket, userekID } = useContext(coursesContext)!; + const { selectBasketCourses, saveBasket, userID } = useContext(coursesContext)!; const basketCourses = selectBasketCourses(); - const handleSave = debounce(() => saveBasket(userekID), 500); + const handleSave = debounce(() => saveBasket(userID), 500); return ( ZAPISZ diff --git a/src/contexts/CASProvider.tsx b/src/contexts/CASProvider.tsx index 84b44a9..78ca720 100644 --- a/src/contexts/CASProvider.tsx +++ b/src/contexts/CASProvider.tsx @@ -30,12 +30,12 @@ export const CASProvider = ({ children }: CASProviderProps) => { sessionStorage.setItem('userToken', token.token); sessionStorage.setItem('userPrivilage', token.authorityRole) } - const tokenik:any = JSON.parse(sessionStorage.getItem('userToken')as string); + const tokenTMP:any = JSON.parse(sessionStorage.getItem('userToken')as string); const token: Token = { - authorityRole: tokenik.authorityRole, - email: tokenik.email, - id: tokenik.id, - token: tokenik.token, + authorityRole: tokenTMP.authorityRole, + email: tokenTMP.email, + id: tokenTMP.id, + token: tokenTMP.token, }; setToken(token.token); } catch (e) { diff --git a/src/contexts/CoursesProvider.tsx b/src/contexts/CoursesProvider.tsx index 4221f33..6e0ab3c 100644 --- a/src/contexts/CoursesProvider.tsx +++ b/src/contexts/CoursesProvider.tsx @@ -18,7 +18,7 @@ interface CourseContext { courses: Array; basket: Array; hoveredGroup: Group | undefined | null; - userekID:string; + userID:string; addCourseToBasket: (courses: Course) => void; changeHoveredGroup: (group: Group | null) => void; changeGroupInBasket: (group: Group, courseId: number) => void; @@ -45,7 +45,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { //fetch courses with groups const [courses, setCourses] = useState>([]); const [basket, setBasket] = useState>([]); - const [userekID, setUserID] = useState(""); + const [userID, setUserID] = useState(""); const [hoveredGroup, setHoveredGroup] = useState(null); const selectBasketIds = () => { const classesIds = basket.map((course) => course?.classes?.id).filter((course) => course !== undefined); @@ -103,7 +103,6 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { const getUserID = async (userID:string) => { setUserID(userID); - console.log("bjhkfbkjakbhjlfasbjkhlfabjklasfbjkbjkasfbjkasfl",userekID) } const saveBasket = async (userID:string) => { @@ -207,7 +206,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => { return (