feat: now message editor will save the selected channel as default channel
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import { Button, Form, Segment } from 'semantic-ui-react';
|
import { Button, Form, Header, Segment } from 'semantic-ui-react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
import { API, showError, showSuccess } from '../../helpers';
|
import { API, showError, showSuccess } from '../../helpers';
|
||||||
import { loadUser, loadUserChannels } from '../../helpers/loader';
|
import { loadUser, loadUserChannels } from '../../helpers/loader';
|
||||||
@@ -21,7 +21,7 @@ const EditMessage = () => {
|
|||||||
description: '',
|
description: '',
|
||||||
content: '',
|
content: '',
|
||||||
url: '',
|
url: '',
|
||||||
channel: '',
|
channel: localStorage.getItem('editor_channel') || '',
|
||||||
to: '',
|
to: '',
|
||||||
async: false,
|
async: false,
|
||||||
};
|
};
|
||||||
@@ -31,6 +31,9 @@ const EditMessage = () => {
|
|||||||
|
|
||||||
const handleInputChange = (e, { name, value }) => {
|
const handleInputChange = (e, { name, value }) => {
|
||||||
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
setInputs((inputs) => ({ ...inputs, [name]: value }));
|
||||||
|
if (name === "channel") {
|
||||||
|
localStorage.setItem('editor_channel', value);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const loadMessage = async () => {
|
const loadMessage = async () => {
|
||||||
@@ -84,6 +87,7 @@ const EditMessage = () => {
|
|||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Segment loading={loading} className={'clearing'}>
|
<Segment loading={loading} className={'clearing'}>
|
||||||
|
<Header as='h3'>消息编辑</Header>
|
||||||
<Form>
|
<Form>
|
||||||
<Form.Group widths='equal'>
|
<Form.Group widths='equal'>
|
||||||
<Form.Input
|
<Form.Input
|
||||||
|
|||||||
Reference in New Issue
Block a user