{"size": 348, "ext": "js", "max_stars_repo_path": "src/client/src/hooks/useUser.js", "max_stars_repo_name": "pirocorp/ReactJS-Project", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/client/src/hooks/useUser.js", "max_issues_repo_name": "pirocorp/ReactJS-Project", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/client/src/hooks/useUser.js", "max_forks_repo_name": "pirocorp/ReactJS-Project", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.4705882353, "max_line_length": 67, "alphanum_fraction": 0.617816092}
import { useState } from 'react';

import authService from '../services/authService';

export default function useUser() {
    const [user, setUser] = useState(authService.getCurrentUser());

    const saveUser = (user) => {
        authService.setCurrentUser(user);
        setUser(user);
    }

    return [
        user,
        saveUser
    ]
}