This commit is contained in:
wrzesinski-hubert 2020-12-10 21:51:01 +01:00
parent b6121a5eee
commit 8ba07f5c07
4 changed files with 10 additions and 12 deletions

View File

@ -205,7 +205,6 @@ export const CourseCard = ({ course }: CourseCardProps) => {
{group.lecturer.replace('UAM', '')} {group.lecturer.replace('UAM', '')}
</FlexItem> </FlexItem>
)} )}
{console.log("abisfdibuafsbuiafsbuifasbuibuiafsbuifasbuifsabuiasf",group)}
<FlexItem style={{ justifyContent: 'center', margin: '0 50px' }}> <FlexItem style={{ justifyContent: 'center', margin: '0 50px' }}>
<span> {createClassTime(group.time)[0] + " - " + createClassTime(group.time)[1]} {/* Sala: {group.room} */}</span> <span> {createClassTime(group.time)[0] + " - " + createClassTime(group.time)[1]} {/* Sala: {group.room} */}</span>
</FlexItem> </FlexItem>

View File

@ -48,10 +48,10 @@ const SaveButton = styled.div`
`; `;
export const Rightbar = () => { export const Rightbar = () => {
const { selectBasketCourses, saveBasket, userekID } = useContext(coursesContext)!; const { selectBasketCourses, saveBasket, userID } = useContext(coursesContext)!;
const basketCourses = selectBasketCourses(); const basketCourses = selectBasketCourses();
const handleSave = debounce(() => saveBasket(userekID), 500); const handleSave = debounce(() => saveBasket(userID), 500);
return ( return (
<RightbarWrapper> <RightbarWrapper>
<SaveButton onClick={handleSave}>ZAPISZ</SaveButton> <SaveButton onClick={handleSave}>ZAPISZ</SaveButton>

View File

@ -30,12 +30,12 @@ export const CASProvider = ({ children }: CASProviderProps) => {
sessionStorage.setItem('userToken', token.token); sessionStorage.setItem('userToken', token.token);
sessionStorage.setItem('userPrivilage', token.authorityRole) 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 = { const token: Token = {
authorityRole: tokenik.authorityRole, authorityRole: tokenTMP.authorityRole,
email: tokenik.email, email: tokenTMP.email,
id: tokenik.id, id: tokenTMP.id,
token: tokenik.token, token: tokenTMP.token,
}; };
setToken(token.token); setToken(token.token);
} catch (e) { } catch (e) {

View File

@ -18,7 +18,7 @@ interface CourseContext {
courses: Array<Course>; courses: Array<Course>;
basket: Array<Basket>; basket: Array<Basket>;
hoveredGroup: Group | undefined | null; hoveredGroup: Group | undefined | null;
userekID:string; userID:string;
addCourseToBasket: (courses: Course) => void; addCourseToBasket: (courses: Course) => void;
changeHoveredGroup: (group: Group | null) => void; changeHoveredGroup: (group: Group | null) => void;
changeGroupInBasket: (group: Group, courseId: number) => void; changeGroupInBasket: (group: Group, courseId: number) => void;
@ -45,7 +45,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
//fetch courses with groups //fetch courses with groups
const [courses, setCourses] = useState<Array<Course>>([]); const [courses, setCourses] = useState<Array<Course>>([]);
const [basket, setBasket] = useState<Array<Basket>>([]); const [basket, setBasket] = useState<Array<Basket>>([]);
const [userekID, setUserID] = useState(""); const [userID, setUserID] = useState("");
const [hoveredGroup, setHoveredGroup] = useState<Group | undefined | null>(null); const [hoveredGroup, setHoveredGroup] = useState<Group | undefined | null>(null);
const selectBasketIds = () => { const selectBasketIds = () => {
const classesIds = basket.map((course) => course?.classes?.id).filter((course) => course !== undefined); 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) => { const getUserID = async (userID:string) => {
setUserID(userID); setUserID(userID);
console.log("bjhkfbkjakbhjlfasbjkhlfabjklasfbjkbjkasfbjkasfl",userekID)
} }
const saveBasket = async (userID:string) => { const saveBasket = async (userID:string) => {
@ -207,7 +206,7 @@ export const CoursesProvider = ({ children }: CoursesProviderProps) => {
return ( return (
<coursesContext.Provider <coursesContext.Provider
value={{ value={{
userekID, userID,
courses, courses,
basket, basket,
hoveredGroup, hoveredGroup,