Tweak system editing

This commit is contained in:
Spectralitree
2020-12-12 21:04:10 +01:00
parent 806c7857f5
commit 759c14c6db
4 changed files with 9 additions and 8 deletions

View File

@@ -4,6 +4,7 @@ import { useForm } from "react-hook-form";
import moment from 'moment';
import Popup from 'reactjs-popup';
import 'reactjs-popup/dist/index.css';
import autosize from 'autosize';
import API_URL from "../Constants/constants.js";
@@ -57,6 +58,10 @@ export default function MemberCard(props) {
handleSubmit: handleSubmitProxy,
} = useForm();
useEffect(() => {
autosize(document.querySelector('textarea'));
})
useEffect(() => {
const { toHTML } = require('../Functions/discord-parser.js');

View File

@@ -3,7 +3,6 @@ import * as BS from 'react-bootstrap'
import Popup from 'reactjs-popup';
import 'reactjs-popup/dist/index.css';
import { useForm } from "react-hook-form";
import autosize from 'autosize';
import MemberCard from './MemberCard.js'
import Loading from "./Loading.js";
@@ -59,10 +58,6 @@ export default function Memberlist(props) {
fetchMembers();
}, [fetchMembers])
useEffect(() => {
autosize(document.querySelector('textarea'));
})
function addProxyField() {
setProxyTags(oldTags => [...oldTags, {prefix: '', suffix: ''}] )
}

View File

@@ -80,7 +80,7 @@ const submitEdit = data => {
'Content-Type': 'application/json',
'Authorization': JSON.stringify(localStorage.getItem("token")).slice(1, -1)
}}).then (res => res.json()
).then ( data => { setUser(prevState => {return {...prevState, ...data}}); localStorage.setItem('user', JSON.stringify(user)); setEditMode(false)}
).then ( () => { setUser(prevState => {return {...prevState, ...data}}); localStorage.setItem('user', JSON.stringify(user)); setEditMode(false)}
).catch (error => {
console.error(error);
setErrorAlert(true);
@@ -114,7 +114,8 @@ const submitPrivacy = data => {
{ errorAlert ? <BS.Alert variant="danger">Something went wrong, please try logging in and out again.</BS.Alert> : "" }
{ editMode ?
<BS.Form onSubmit={handleSubmitEdit(submitEdit)}>
{/* <BS.Form.Text className='mb-4'>Note: changes here may take a while to be reflected on the bot. This is due to the bot caching data.<br/> Try editing a member after to make the changes show up.</BS.Form.Text> */}
<BS.Form.Text className='mb-4'><b>Note:</b> if you refresh the page, the old data might show up again, this is due to the bot caching data.<br/>
Try editing a member to clear the cache, or wait a few minutes before refreshing.</BS.Form.Text>
<BS.Form.Row>
<BS.Col className="mb-lg-2" xs={12} lg={3}>
<BS.Form.Label>Name:</BS.Form.Label>