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', '')}
</FlexItem>
)}
{console.log("abisfdibuafsbuiafsbuifasbuibuiafsbuifasbuifsabuiasf",group)}
<FlexItem style={{ justifyContent: 'center', margin: '0 50px' }}>
<span> {createClassTime(group.time)[0] + " - " + createClassTime(group.time)[1]} {/* Sala: {group.room} */}</span>
</FlexItem>

View File

@ -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 (
<RightbarWrapper>
<SaveButton onClick={handleSave}>ZAPISZ</SaveButton>

View File

@ -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) {

View File

@ -18,7 +18,7 @@ interface CourseContext {
courses: Array<Course>;
basket: Array<Basket>;
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<Array<Course>>([]);
const [basket, setBasket] = useState<Array<Basket>>([]);
const [userekID, setUserID] = useState("");
const [userID, setUserID] = useState("");
const [hoveredGroup, setHoveredGroup] = useState<Group | undefined | null>(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 (
<coursesContext.Provider
value={{
userekID,
userID,
courses,
basket,
hoveredGroup,