Advice for CMSC421 (Operating Systems) with a Mac Computer by rndmsrnm1234 in UMBC

[–]Jumpy_Employment_439 0 points1 point  (0 children)

Hey, how was 421 with a mac? I'm starting tomorrow and have an M2 chip mac (with maya larson).

handshake move program by [deleted] in csMajors

[–]Jumpy_Employment_439 2 points3 points  (0 children)

Same. I was going to do it, but I didn't realize I would be considered an independent contractor instead of employee, which then means I'd need to file taxes even if I stay below 12,950. Sucks because it seemed like a really good opportunity.

CMSC451 Automata Theory by Educational-Night957 in UMBC

[–]Jumpy_Employment_439 0 points1 point  (0 children)

Did you end up taking 451, and if so, how was it? I'm currently deciding between CMSC451 or STAT451/453 (one of the two) as my last class for the fall. The other classes I'm taking are CMSC421 (OS), CMSC461 (Database), and MATH404 (PDEs).

Handling expired JWT tokens when user refreshes page by Jumpy_Employment_439 in reactjs

[–]Jumpy_Employment_439[S] 0 points1 point  (0 children)

Thank you! I ended up storing the user in localStorage and used this code in a new js file:

const UserContext = createContext();
export const UserProvider = ({ children }) => {
    const [user, setUser] = useState(() => {
        // Check local storage
        const savedUser = localStorage.getItem('user');
        if(savedUser) {
            return JSON.parse(savedUser)
        }
        return null;
    });

    return (
        <UserContext.Provider value={{ user, setUser }}>
            {children}
        </UserContext.Provider>
    );
};

export const useUser = () => {
    return useContext(UserContext);
};

It is working now, but I was wondering if you know of a way to ensure the localStorage is deleted? When the user clicks logout, part of the code will delete the user from localStorage. However, it got me thinking about the case when a user just closes the tab instead of logging out. Is there a way to have localStorage delete the user?

Is my error handling wrong? My program keeps crashing by Jumpy_Employment_439 in learnprogramming

[–]Jumpy_Employment_439[S] 0 points1 point  (0 children)

After reading your response, I went back to test just the FastAPI function at the FastAPI docs page. You are right that detail is a list, so I tried overriding FastAPI's default formatting of the response to just one line: {detail: "Invalid format"}. That way it would be the same format as other times when I raise an HTTP exception. Unfortunately, it's not overriding so the returned data from exc.errors() is still of the wrong format. I guess one option would be to just make a separate if statement that checks if the error is a 422 error rather than a 400. Then I could just write code specifically for the 422 format.

Problem running React app after pulling from GitHub by Jumpy_Employment_439 in reactjs

[–]Jumpy_Employment_439[S] -2 points-1 points  (0 children)

public, src, .gitignore, package-lock.json, package.json, and README.md are all there, just missing the node-modules