{"size": 1775, "ext": "js", "max_stars_repo_path": "store/slices/auth/authAPI.js", "max_stars_repo_name": "abhey-sujith/note-app-react-native", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "store/slices/auth/authAPI.js", "max_issues_repo_name": "abhey-sujith/note-app-react-native", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "store/slices/auth/authAPI.js", "max_forks_repo_name": "abhey-sujith/note-app-react-native", "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": 24.6527777778, "max_line_length": 68, "alphanum_fraction": 0.5695774648}

export const registerUser = async (userDetails) => {
  try {
    console.log('inside registerUser');
    const response = await fetch(
      'https://note-app-laravel-api.herokuapp.com/api/v1/register',{
        method: 'POST',
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          email: userDetails.email,
          name: userDetails.name,
          password: userDetails.password,
          password_confirmation: userDetails.password_confirmation
        })
      }
    );
    const json = await response.json();

    return json;
  } catch (error) {
    console.error(error);
  }
};


export const LoginUser = async (userDetails) => {
  try {
    console.log('inside registerUser');
    const response = await fetch(
      'https://note-app-laravel-api.herokuapp.com/api/v1/login',{
        method: 'POST',
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          email: userDetails.email,
          password: userDetails.password,
        })
      }
    );
    const json = await response.json();

    return json;
  } catch (error) {
    console.error(error);
  }
};

export const LogoutUser = async (token) => {
  try {
    console.log('inside registerUser');
    const response = await fetch(
      'https://note-app-laravel-api.herokuapp.com/api/v1/logout',{
        method: 'POST',
        headers: {
          'Authorization': 'Bearer '+{token},
          Accept: 'application/json',
          'Content-Type': 'application/json'
        },
      }
    );
    const json = await response.json();

    return json;
  } catch (error) {
    console.error(error);
  }
};