diff --git a/client/homebrew/pages/editPage/lockNotification/lockNotification.jsx b/client/homebrew/pages/editPage/lockNotification/lockNotification.jsx index c5eeaee47..da79ff265 100644 --- a/client/homebrew/pages/editPage/lockNotification/lockNotification.jsx +++ b/client/homebrew/pages/editPage/lockNotification/lockNotification.jsx @@ -1,17 +1,28 @@ require('./lockNotification.less'); const React = require('react'); +const request = require('../../../utils/request-middleware.js'); import Dialog from '../../../../components/dialog.jsx'; function LockNotification(props) { props = { shareId : 0, disableLock : ()=>{}, - message : '', + lock : {}, ...props }; - const removeLock = ()=>{ - alert(`Not yet implemented - ID ${props.shareId}`); + const [reviewState, setReviewState] = React.useState(false); + + const removeLock = async ()=>{ + await request.put(`/admin/lock/review/request/${props.shareId}`) + .then(()=>{ + setReviewState(true); + }); + }; + + const renderReviewButton = function(){ + if(reviewState || props.lock.reviewRequested){ return REVIEW REQUESTED; }; + return REQUEST LOCK REMOVAL; }; return @@ -19,11 +30,11 @@ function LockNotification(props) { This brew been locked by the Administrators. It will not be accessible by any method other than the Editor until the lock is removed. LOCK REASON - {props.message || 'Unable to retrieve Lock Message'} + {props.lock.editMessage || 'Unable to retrieve Lock Message'} Once you have resolved this issue, click REQUEST LOCK REMOVAL to notify the Administrators for review. Click CONTINUE TO EDITOR to temporarily hide this notification; it will reappear the next time the page is reloaded. - REQUEST LOCK REMOVAL + {renderReviewButton()} ; };
This brew been locked by the Administrators. It will not be accessible by any method other than the Editor until the lock is removed.
{props.message || 'Unable to retrieve Lock Message'}
{props.lock.editMessage || 'Unable to retrieve Lock Message'}
Once you have resolved this issue, click REQUEST LOCK REMOVAL to notify the Administrators for review.
Click CONTINUE TO EDITOR to temporarily hide this notification; it will reappear the next time the page is reloaded.