+ Data: {JSON.stringify(data)}
+
+ );
+}
+
+export default UserOutfitsPage;
diff --git a/src/app/components/useRequireLogin.js b/src/app/components/useRequireLogin.js
new file mode 100644
index 0000000..ebc057c
--- /dev/null
+++ b/src/app/components/useRequireLogin.js
@@ -0,0 +1,30 @@
+import React from "react";
+import { useAuth0 } from "@auth0/auth0-react";
+
+/**
+ * useRequireLogin redirects to a login page, if the user is not already logged
+ * in.
+ *
+ * Returns an object {isLoading: Boolean}, which is true if we're loading or
+ * redirecting, or false if the user is logged in and we can proceed.
+ */
+function useRequireLogin() {
+ const { isLoading, isAuthenticated, loginWithRedirect } = useAuth0();
+
+ const isRedirecting = !isLoading && !isAuthenticated;
+
+ React.useEffect(() => {
+ if (isRedirecting) {
+ loginWithRedirect({
+ redirectUri: window.location.href,
+ });
+ }
+ }, [isRedirecting, loginWithRedirect]);
+
+ // We tell the caller that we're "loading" even in the authenticated case,
+ // because we want them to continue to show their loading state while we
+ // redirect.
+ return { isLoading: isLoading || isRedirecting };
+}
+
+export default useRequireLogin;
diff --git a/src/app/util.js b/src/app/util.js
index 3b9ccad..0d8a2f0 100644
--- a/src/app/util.js
+++ b/src/app/util.js
@@ -81,6 +81,13 @@ export function Heading3({ children, ...props }) {
);
}
+/**
+ * ErrorMessage is a simple error message for simple errors!
+ */
+export function ErrorMessage({ children }) {
+ return