mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-26 09:00:57 -05:00
Update Prompt.tsx
This commit is contained in:
parent
49d54ee05a
commit
dccc0f4eb7
1 changed files with 5 additions and 8 deletions
|
@ -463,9 +463,6 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
|
||||||
}
|
}
|
||||||
case "create_category": {
|
case "create_category": {
|
||||||
const [name, setName] = useState("");
|
const [name, setName] = useState("");
|
||||||
const [cats, setCats] = useState<Category[]>(
|
|
||||||
props.target.categories ?? [],
|
|
||||||
);
|
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@ -482,12 +479,12 @@ export const SpecialPromptModal = observer((props: SpecialProps) => {
|
||||||
onClick: async () => {
|
onClick: async () => {
|
||||||
setProcessing(true);
|
setProcessing(true);
|
||||||
try {
|
try {
|
||||||
cats.push({
|
props.target.edit({
|
||||||
id: ulid(),
|
categories: [
|
||||||
title: name,
|
...props.target.categories ?? [],
|
||||||
channels: [],
|
{ id: ulid(), title: name, channels: [] }
|
||||||
|
]
|
||||||
});
|
});
|
||||||
props.target.edit({ categories: cats });
|
|
||||||
onClose();
|
onClose();
|
||||||
setProcessing(false);
|
setProcessing(false);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Reference in a new issue