se701g2 / Doto

Todo application for Group 2
https://doto.azurewebsites.net/
MIT License
12 stars 42 forks source link

issue/162 - Prevent access to calendar and settings page and redirect when not logged in closes #162 #237

Closed AlexanderTheGrape closed 4 years ago

AlexanderTheGrape commented 4 years ago

issue/162 - Prevent access to calendar and settings page and redirect when not logged in

AlexanderTheGrape commented 4 years ago

There's just one remaining linting issue I haven't been able to change so far. It says "React Hook useEffect has a missing dependency: 'setTheme'.", but when I import setTheme, the import doesn't get used. If any reviewers have a suggestion, please let me know!

Matteas-Eden commented 4 years ago

There's just one remaining linting issue I haven't been able to change so far. It says "React Hook useEffect has a missing dependency: 'setTheme'.", but when I import setTheme, the import doesn't get used. If any reviewers have a suggestion, please let me know!

So I looked into it, and it appears that the code causing the build to fail is:

useEffect(() => {
    const fetchTasks = async () => {
        const tasks = await DotoService.getTasks();
        setTasks(tasks);
    };
    const fetchUserInfo = async () => {
        const userInfo = await DotoService.getUserInfo();
        setTheme(userInfo.themePreference);
    };
    fetchUserInfo();
    fetchTasks();
}, []);

This little code snippet is from doto-frontend/src/components/pages/Calendar/Calendar.js. The reason that the build is failing is because of the empty array after the anonymous function. As in; useEffect(()=>{...}, []) That second argument is causing the build to fail. So, try removing it. It's a little strange because this file wasn't actually changed by your PR, but maybe if this works then your PR can fix it.

AlexanderTheGrape commented 4 years ago

Cheers Matt, I've made that change and works as expected.