client: lint and fix building due to missing type

This commit is contained in:
Max Leiter 2022-04-14 14:32:20 -07:00
parent b9d26e16f7
commit 00b03db3ef
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A3512F2F2F17EBDA
4 changed files with 20 additions and 13 deletions

View file

@ -38,7 +38,7 @@ const VisibilityControl = ({ postId, visibility, setVisibility }: Props) => {
setPasswordModalVisible(false)
}
},
[setToast]
[postId, setToast, setVisibility]
)
const onSubmit = useCallback(
@ -63,7 +63,7 @@ const VisibilityControl = ({ postId, visibility, setVisibility }: Props) => {
}
const submitPassword = useCallback(
(password) => onSubmit("protected", password),
(password: string) => onSubmit("protected", password),
[onSubmit]
)

View file

@ -110,7 +110,7 @@ const Post = ({
setSubmitting(false)
}
},
[docs, router, setToast, title]
[description, docs, router, setToast, title]
)
const [isSubmitting, setSubmitting] = useState(false)
@ -192,7 +192,7 @@ const Post = ({
)
const onChangeDescription = useCallback(
(e: ChangeEvent<HTMLTextAreaElement>) => {
(e: ChangeEvent<HTMLInputElement>) => {
setDescription(e.target.value)
},
[setDescription]

View file

@ -166,9 +166,15 @@ const PostPage = ({ post: initialPost, isProtected }: Props) => {
content={content}
/>
))}
{isOwner && <span className={styles.controls}>
<VisibilityControl postId={post.id} visibility={visibility} setVisibility={setVisibility} />
</span>}
{isOwner && (
<span className={styles.controls}>
<VisibilityControl
postId={post.id}
visibility={visibility}
setVisibility={setVisibility}
/>
</span>
)}
<ScrollToTop />
</Page.Content>
</Page>

View file

@ -403,7 +403,6 @@ posts.delete("/:id", jwt, async (req: UserJwtRequest, res, next) => {
}
})
posts.put(
"/:id",
jwt,
@ -415,7 +414,7 @@ posts.put(
visibility: Joi.string()
.custom(postVisibilitySchema, "valid visibility")
.required(),
password: Joi.string().optional(),
password: Joi.string().optional()
}
}),
async (req: UserJwtRequest, res, next) => {
@ -427,7 +426,7 @@ posts.put(
)
}
const { visibility, password } = req.body;
const { visibility, password } = req.body
let hashedPassword: string = ""
if (visibility === "protected") {
@ -437,14 +436,14 @@ posts.put(
.digest("hex")
}
const { id } = req.params;
const { id } = req.params
const post = await Post.findByPk(id, {
include: [
{
model: User,
as: "users",
attributes: ["id"]
},
}
]
})
@ -453,7 +452,9 @@ posts.put(
}
if (!isUserAuthor(post)) {
return res.status(403).json({ error: "This post does not belong to you" })
return res
.status(403)
.json({ error: "This post does not belong to you" })
}
await Post.update(