Bugfix
This commit is contained in:
@@ -161,6 +161,10 @@ export default class API {
|
||||
return this.apiCall("user/create", { username: username, email: email, password: password, confirmPassword: confirmPassword });
|
||||
}
|
||||
|
||||
async searchUser(query) {
|
||||
return this.apiCall("user/search", { query : query });
|
||||
}
|
||||
|
||||
async updateProfile(username=null, fullName=null, password=null, confirmPassword = null, oldPassword = null) {
|
||||
let res = await this.apiCall("user/updateProfile", { username: username, fullName: fullName,
|
||||
password: password, confirmPassword: confirmPassword, oldPassword: oldPassword });
|
||||
|
||||
@@ -24,7 +24,7 @@ export default function Dialog(props) {
|
||||
if (props.inputs) {
|
||||
let initialData = {};
|
||||
for (const input of props.inputs) {
|
||||
if (input.type !== "label") {
|
||||
if (input.type !== "label" && input.hasOwnProperty("name")) {
|
||||
initialData[input.name] = input.value || "";
|
||||
}
|
||||
}
|
||||
@@ -76,6 +76,14 @@ export default function Dialog(props) {
|
||||
{listItems}
|
||||
</List>
|
||||
</Box>);
|
||||
break;
|
||||
case 'custom':
|
||||
let element = inputProps.element;
|
||||
delete inputProps.element;
|
||||
inputElements.push(React.createElement(element, inputProps));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
28
react/shared/elements/search-field.js
Normal file
28
react/shared/elements/search-field.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import {Autocomplete, TextField} from "@mui/material";
|
||||
import useAsyncSearch from "../hooks/async-search";
|
||||
|
||||
|
||||
export default function SearchField(props) {
|
||||
|
||||
const { onSearch, displayText, onSelect, ...other } = props;
|
||||
|
||||
const [searchString, setSearchString, results] = useAsyncSearch(props.onSearch, 3);
|
||||
|
||||
return <Autocomplete {...other}
|
||||
getOptionLabel={r => displayText(r)}
|
||||
options={Object.values(results ?? {})}
|
||||
onChange={(e, n) => onSelect(n)}
|
||||
renderInput={(params) => (
|
||||
<TextField
|
||||
{...params}
|
||||
value={searchString}
|
||||
onChange={e => setSearchString(e.target.value)}
|
||||
label={"Search input"}
|
||||
InputProps={{
|
||||
...params.InputProps,
|
||||
type: 'search',
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
/>;
|
||||
}
|
||||
Reference in New Issue
Block a user