You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
Create new authorized endpoint /api/posts/edit/:id that runs auth middleware and takes a JSON object payload with edit details
Validate 'x-access-token' via auth middleware and set req.user to payload.
Parse through data same way as done for /api/upload/
Use SQL Update to update where postId === and userId === req.user.id (the where clause will return negative if payload userid is not equal, and there will be no rows returning)
Validate inputs with post schema
Throw 404s if post doesn't exist
Test with HTTPie
Handle all errors and respond to the client
⚡ Client
Add context menu <SymbolArtContextMenu> positioned to right side of <SymbolArtCard> title, displaying edit and delete post options. Only visible if the post's userId matches the current AppContext.userId
Attach the same component to <SinglePostSingleArt>
Create form modal components that handle editing and deleting, using <DaisyModal> to handle displaying it.
For edit form, take prop of current Symbol Art data and prefill form state and preview image with the data.
Use the same form input logic as upload.jsx
Handle submit by sending a fetch request with the current AppContext.usertoken to /api/posts/edit/:id, and close modal upon success.
The text was updated successfully, but these errors were encountered:
Sub Feature of #9
Prereqs:
yup
library for value checking #41✅ Task List
☁️ Server
/api/posts/edit/:id
that runs auth middleware and takes a JSON object payload with edit details'x-access-token'
via auth middleware and setreq.user
to payload./api/upload/
postId
=== anduserId === req.user.id
(thewhere
clause will return negative if payload userid is not equal, and there will be no rows returning)⚡ Client
<SymbolArtContextMenu>
positioned to right side of<SymbolArtCard>
title, displaying edit and delete post options. Only visible if the post'suserId
matches the currentAppContext.userId
<SinglePostSingleArt>
<DaisyModal>
to handle displaying it.upload.jsx
AppContext.usertoken
to/api/posts/edit/:id
, and close modal upon success.The text was updated successfully, but these errors were encountered: