lint project
This commit is contained in:
@@ -77,13 +77,17 @@ export const updatePart = async ({ id, input }) => {
|
||||
}
|
||||
const originalPart = await db.part.findUnique({ where: { id } })
|
||||
const imageToDestroy =
|
||||
originalPart.mainImage !== input.mainImage && input.mainImage && originalPart.mainImage
|
||||
originalPart.mainImage !== input.mainImage &&
|
||||
input.mainImage &&
|
||||
originalPart.mainImage
|
||||
const update = await db.part.update({
|
||||
data: foreignKeyReplacement(input),
|
||||
where: { id },
|
||||
})
|
||||
if (imageToDestroy) {
|
||||
console.log(`image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`)
|
||||
console.log(
|
||||
`image destroyed, publicId: ${imageToDestroy}, partId: ${id}, replacing image is ${input.mainImage}`
|
||||
)
|
||||
// destroy after the db has been updated
|
||||
destroyImage({ publicId: imageToDestroy })
|
||||
}
|
||||
|
||||
@@ -27,7 +27,8 @@ const PartProfile = ({
|
||||
const [isInvalid, setIsInvalid] = useState(false)
|
||||
const { currentUser } = useAuth()
|
||||
const editorRef = useRef(null)
|
||||
const canEdit = currentUser?.sub === userPart.id || currentUser?.roles.includes('admin')
|
||||
const canEdit =
|
||||
currentUser?.sub === userPart.id || currentUser?.roles.includes('admin')
|
||||
const isImageEditable = !isEditable && canEdit // image is editable when not in profile edit mode in order to separate them as it's too hard too to upload an image to cloudinary temporarily until the use saves (and maybe have to clean up) for the time being
|
||||
const part = userPart?.Part
|
||||
const emotes = countEmotes(part?.Reaction)
|
||||
|
||||
Reference in New Issue
Block a user