From 51df6aa52331d3ae964da9f709442927e13db43a Mon Sep 17 00:00:00 2001 From: "Ahmed K.A" Date: Tue, 7 Feb 2023 16:37:40 +0300 Subject: [PATCH 1/5] fix: set correct import names --- src/index.tsx | 2 +- src/pages/Chat/index.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 3b0c334..21d932e 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -9,7 +9,7 @@ const ChatPage = lazy(() => import("./pages/Chat")); const CharacterSettings = lazy(() => import("./pages/CharacterSettings")); const Home = lazy(() => import("./pages/Home")); const Account = lazy(() => import("./pages/Account")); -const Register = lazy(() => import("./pages/Account/Register")); +const Register = lazy(() => import("./pages/Account/register")); const App: Component = () => ( diff --git a/src/pages/Chat/index.tsx b/src/pages/Chat/index.tsx index 14a072b..4cf8c87 100644 --- a/src/pages/Chat/index.tsx +++ b/src/pages/Chat/index.tsx @@ -3,7 +3,7 @@ import { For } from "solid-js"; import Header from "./components/Header"; import InputBar from "./components/InputBar"; import Message from "./components/Message"; -import mockMessages from "./mocks"; +import { mockMessages } from "./mocks"; const ChatPage = () => (
Date: Tue, 7 Feb 2023 16:38:00 +0300 Subject: [PATCH 2/5] fix: add missing mock data --- src/pages/Chat/mocks.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/pages/Chat/mocks.ts diff --git a/src/pages/Chat/mocks.ts b/src/pages/Chat/mocks.ts new file mode 100644 index 0000000..c8bb83b --- /dev/null +++ b/src/pages/Chat/mocks.ts @@ -0,0 +1,13 @@ +import Message from "../../models/Message"; + +export const mockMessages: Message[] = [ + { + speaker: { + name: "John", + avatarUrl: "#", + isHuman: true, + }, + utterance: "Hi Robot", + timestamp: new Date(), + }, +]; From 0d0317e454affd5be9a2003f201662cae1b0a952 Mon Sep 17 00:00:00 2001 From: "Ahmed K.A" Date: Fri, 17 Feb 2023 11:34:13 +0300 Subject: [PATCH 3/5] Add type assertion when updating appstore --- src/hooks/auth.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hooks/auth.tsx b/src/hooks/auth.tsx index 049b339..259616b 100644 --- a/src/hooks/auth.tsx +++ b/src/hooks/auth.tsx @@ -1,5 +1,6 @@ import Cookies from "js-cookie"; import { parseJWT } from "../api"; +import User from "../models/User"; import { useAppStore } from "../providers/AppStoreProvider"; /** Hook to interact with authentication data within the global app store. */ @@ -16,7 +17,7 @@ const useAuth = (): { * decoded version of the JWT for use elsewhere. */ const login = (jwt: string) => { - updateAppStore("auth", { jwt, user: parseJWT(jwt) }); + updateAppStore("auth", { jwt, user: (parseJWT(jwt) as User) || undefined }); Cookies.set("jwt", jwt, { sameSite: "strict", expires: 7, From c182d5590ad2b8216559cfe9593bb1068e02373e Mon Sep 17 00:00:00 2001 From: "Ahmed K.A" Date: Fri, 17 Feb 2023 11:46:48 +0300 Subject: [PATCH 4/5] Add passing of empty array when query.data is undefined --- src/pages/Home/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Home/index.tsx b/src/pages/Home/index.tsx index 6fcac82..d2fbf27 100644 --- a/src/pages/Home/index.tsx +++ b/src/pages/Home/index.tsx @@ -43,7 +43,7 @@ const HomePage: Component = () => { From f5d6534b2d7d8c66a0f9b6065d3a50c7254b686f Mon Sep 17 00:00:00 2001 From: "Ahmed K.A" Date: Fri, 17 Feb 2023 11:49:35 +0300 Subject: [PATCH 5/5] Remove incorrect (as undefined) typing --- src/hooks/auth.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hooks/auth.tsx b/src/hooks/auth.tsx index 259616b..44e92ab 100644 --- a/src/hooks/auth.tsx +++ b/src/hooks/auth.tsx @@ -17,7 +17,7 @@ const useAuth = (): { * decoded version of the JWT for use elsewhere. */ const login = (jwt: string) => { - updateAppStore("auth", { jwt, user: (parseJWT(jwt) as User) || undefined }); + updateAppStore("auth", { jwt, user: parseJWT(jwt) as User }); Cookies.set("jwt", jwt, { sameSite: "strict", expires: 7,