-
- Good Morning 🌥 🗞
-
+
+
+ {getTimeOfDay(new Date().getHours())} 🗞
+
+
+
+
{!loading
? posts.map((post, i) => {
diff --git a/web/pages/onboarding.js b/web/pages/onboarding.js
index cfb2b0d..ed41613 100644
--- a/web/pages/onboarding.js
+++ b/web/pages/onboarding.js
@@ -1,5 +1,5 @@
import { useRouter } from "next/dist/client/router";
-import React, { useState } from "react";
+import React, { useEffect, useState } from "react";
import { useAuth } from "../lib/auth";
import { updateUser } from "../lib/signupComplete";
@@ -11,11 +11,17 @@ export default function OnBoarding() {
});
const router = useRouter();
-
+ const { currentUser } = useAuth();
const handleChange = (e) => {
setUserObject({ ...userObject, [e.target.name]: e.target.value });
};
+ useEffect(() => {
+ if (!currentUser) {
+ router.push("/");
+ }
+ }, [router, currentUser]);
+
const handleSubmit = async (e) => {
e.preventDefault();
let tagsToBeSent = [];
@@ -35,11 +41,12 @@ export default function OnBoarding() {
Full Name
@@ -62,11 +69,12 @@ export default function OnBoarding() {
*/}
@@ -74,11 +82,12 @@ export default function OnBoarding() {
Username
diff --git a/web/pages/posts/edit.js b/web/pages/posts/edit.js
index b79f1a7..002218d 100644
--- a/web/pages/posts/edit.js
+++ b/web/pages/posts/edit.js
@@ -1,4 +1,4 @@
-import { useState } from "react";
+import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { toast } from "react-hot-toast";
import ReactMarkdown from "react-markdown";
@@ -7,6 +7,7 @@ import { atomDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
import { searchUsers } from "../../lib/connection";
import { useAuth } from "../../lib/auth";
import { supabase } from "../../lib/supabase";
+import { useRouter } from "next/dist/client/router";
function PostDisplay() {
const { register, handleSubmit, reset, watch, formState } = useForm({
@@ -14,6 +15,7 @@ function PostDisplay() {
});
const currentUser = useAuth();
+ const router = useRouter();
const [preview, setPreview] = useState(false);
@@ -39,8 +41,17 @@ function PostDisplay() {
toast.success("Created Post successfully");
};
+ useEffect(() => {
+ if (!currentUser) {
+ router.push("/");
+ }
+ }, [currentUser, router]);
+
return (