Skip to content
This repository has been archived by the owner on Dec 24, 2024. It is now read-only.

feat(admin/channel): allow setting external id when creating channel #20

Merged
merged 1 commit into from
Jan 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/Admin/Channels/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IconHelpCircle, IconQuestionMark } from "@tabler/icons-react";
const AdminChannelDrawer = ({ handleClose, channel, mode }) => {
const { handleSubmit } = useForm();
const [id, setId] = useState(channel?.id);
const [externalId, setExternalId] = useState(channel?.external_id);
const [name, setName] = useState(channel?.name);
const [displayName, setDisplayName] = useState(channel?.display_name);
const [imagePath, setImagePath] = useState(channel?.image_path);
Expand Down Expand Up @@ -70,6 +71,7 @@ const AdminChannelDrawer = ({ handleClose, channel, mode }) => {
method: "POST",
url: `/api/v1/channel`,
data: {
ext_id: externalId,
name: name,
display_name: displayName,
image_path: imagePath,
Expand Down Expand Up @@ -133,6 +135,15 @@ const AdminChannelDrawer = ({ handleClose, channel, mode }) => {
disabled
mb="xs"
/>
{mode == "create" && (
<TextInput
value={externalId}
onChange={(e) => setExternalId(e.currentTarget.value)}
placeholder="External ID (auto generated if left blank)"
label="External ID"
mb="xs"
/>
)}
<TextInput
value={name}
onChange={(e) => setName(e.currentTarget.value)}
Expand Down