From 35777252d003bb359104e89e05851ae13331e689 Mon Sep 17 00:00:00 2001 From: Deepak Date: Sun, 24 Jan 2021 20:02:38 -0600 Subject: [PATCH] Adds user service to get people's names and things --- .../AuthenticatedApp-snapshot.test.jsx | 5 +++-- src/components/AuthenticatedApp.jsx | 4 ++-- .../UnauthenticatedApp-snapshot.test.jsx | 5 +++-- .../AuthenticatedApp-snapshot.test.jsx.snap | 4 +++- src/context/AuthContext.jsx | 7 +++++-- src/services/user-service.js | 18 ++++++++++++++++++ 6 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 src/services/user-service.js diff --git a/src/components/AuthenticatedApp-snapshot.test.jsx b/src/components/AuthenticatedApp-snapshot.test.jsx index 5b08469..3595228 100644 --- a/src/components/AuthenticatedApp-snapshot.test.jsx +++ b/src/components/AuthenticatedApp-snapshot.test.jsx @@ -4,9 +4,10 @@ import AuthenticatedApp from "./AuthenticatedApp"; import { AuthContext } from "../context/AuthContext"; test("AuthenticatedApp Snapshot", () => { - const appRender = renderer.create( - + ); diff --git a/src/components/AuthenticatedApp.jsx b/src/components/AuthenticatedApp.jsx index 42f278a..36d6686 100644 --- a/src/components/AuthenticatedApp.jsx +++ b/src/components/AuthenticatedApp.jsx @@ -2,11 +2,11 @@ import React from "react"; import { useAuth } from "../context/AuthContext"; function AuthenticatedApp() { - const { logout } = useAuth(); + const { logout, user } = useAuth(); return (
-

Howdy partner.

+

Howdy partner. Your name looks like it's { user.display_name }.

diff --git a/src/components/UnauthenticatedApp-snapshot.test.jsx b/src/components/UnauthenticatedApp-snapshot.test.jsx index afc161c..9487133 100644 --- a/src/components/UnauthenticatedApp-snapshot.test.jsx +++ b/src/components/UnauthenticatedApp-snapshot.test.jsx @@ -4,9 +4,10 @@ import UnauthenticatedApp from "./UnauthenticatedApp"; import { AuthContext } from "../context/AuthContext"; test("UnauthenticatedApp Snapshot", () => { - const appRender = renderer.create( - + ); diff --git a/src/components/__snapshots__/AuthenticatedApp-snapshot.test.jsx.snap b/src/components/__snapshots__/AuthenticatedApp-snapshot.test.jsx.snap index c616075..8c8cea9 100644 --- a/src/components/__snapshots__/AuthenticatedApp-snapshot.test.jsx.snap +++ b/src/components/__snapshots__/AuthenticatedApp-snapshot.test.jsx.snap @@ -3,7 +3,9 @@ exports[`AuthenticatedApp Snapshot 1`] = `

- Howdy partner. + Howdy partner. Your name looks like it's + Ted + .