Skip to content

Commit

Permalink
feat: now message editor will save the selected channel as default ch…
Browse files Browse the repository at this point in the history
…annel
  • Loading branch information
songquanpeng committed May 16, 2023
1 parent 8996737 commit 75282ab
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions web/src/pages/Message/EditMessage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
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 { API, showError, showSuccess } from '../../helpers';
import { loadUser, loadUserChannels } from '../../helpers/loader';
Expand All @@ -21,7 +21,7 @@ const EditMessage = () => {
description: '',
content: '',
url: '',
channel: '',
channel: localStorage.getItem('editor_channel') || '',
to: '',
async: false,
};
Expand All @@ -31,6 +31,9 @@ const EditMessage = () => {

const handleInputChange = (e, { name, value }) => {
setInputs((inputs) => ({ ...inputs, [name]: value }));
if (name === "channel") {
localStorage.setItem('editor_channel', value);
}
};

const loadMessage = async () => {
Expand Down Expand Up @@ -84,6 +87,7 @@ const EditMessage = () => {
return (
<>
<Segment loading={loading} className={'clearing'}>
<Header as='h3'>消息编辑</Header>
<Form>
<Form.Group widths='equal'>
<Form.Input
Expand Down

0 comments on commit 75282ab

Please sign in to comment.