From f12ea9c236d791544d964827cd5b403233972e75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kmak?= Date: Tue, 22 Nov 2022 10:53:39 +0100 Subject: [PATCH] fix: add types to Avatar component --- admin/src/components/AdminAvatar/index.tsx | 3 +-- admin/src/components/Avatar/index.tsx | 14 ++++++++------ server/services/client.ts | 1 - 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/admin/src/components/AdminAvatar/index.tsx b/admin/src/components/AdminAvatar/index.tsx index 166df65..43c4fdb 100644 --- a/admin/src/components/AdminAvatar/index.tsx +++ b/admin/src/components/AdminAvatar/index.tsx @@ -4,9 +4,8 @@ import { AdminAvatarWrapper, AdminShield } from "./styles"; import {Shield} from "@strapi/icons"; // @ts-ignore import {Icon} from "@strapi/design-system/Icon"; -import { ToBeFixed } from "../../../../types"; -const AdminAvatar = ({ children }: ToBeFixed ) => { +const AdminAvatar: React.FC> = ({ children } ) => { return ( diff --git a/admin/src/components/Avatar/index.tsx b/admin/src/components/Avatar/index.tsx index 51a999a..0ad4f11 100644 --- a/admin/src/components/Avatar/index.tsx +++ b/admin/src/components/Avatar/index.tsx @@ -14,8 +14,15 @@ import { Avatar, Initials } from "@strapi/design-system/Avatar"; import { renderInitials } from "../../utils"; import { IntlContext } from "react-intl"; import AdminAvatar from "../AdminAvatar"; +import { ToBeFixed } from "../../../../types"; -const UserAvatar = ({ avatar, name, isAdminComment }) => { +interface IProps { + avatar: string | ToBeFixed; + name: string; + isAdminComment?: boolean; +}; + +const UserAvatar = ({ avatar, name, isAdminComment = false }) => { if (avatar) { let image = avatar; if (isObject(avatar)) { @@ -31,9 +38,4 @@ const UserAvatar = ({ avatar, name, isAdminComment }) => { ) }; -UserAvatar.propTypes = { - avatar: PropTypes.oneOfType(PropTypes.string, PropTypes.object).isRequired, - name: PropTypes.string, -}; - export default UserAvatar; diff --git a/server/services/client.ts b/server/services/client.ts index 15a99b1..47c8081 100644 --- a/server/services/client.ts +++ b/server/services/client.ts @@ -275,7 +275,6 @@ export = ({ strapi }: StrapiContext): IServiceClient => ({ `You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.` ); } catch (e) { - console.log(e); throw e; } },