Compare commits
1 Commits
40540ab8a6
...
c10cdcf2e5
| Author | SHA1 | Date | |
|---|---|---|---|
| c10cdcf2e5 |
@@ -143,15 +143,16 @@ export default function ChatPage() {
|
||||
|
||||
async function createChannel() {
|
||||
if (!guild || !guildToken || !newChannelName.trim()) return
|
||||
if (!guildDbId) {
|
||||
setError('Cannot create channel: guildId is missing')
|
||||
const effectiveGuildId = guildDbId || selectedGuildId
|
||||
if (!effectiveGuildId) {
|
||||
setError('Cannot create channel: no guild selected')
|
||||
return
|
||||
}
|
||||
setError('')
|
||||
try {
|
||||
const payload = {
|
||||
name: newChannelName.trim(),
|
||||
guildId: guildDbId,
|
||||
guildId: effectiveGuildId,
|
||||
memberUserIds: selectedMemberIds,
|
||||
}
|
||||
const res = await guildApi().post('/channels', payload)
|
||||
@@ -242,7 +243,6 @@ export default function ChatPage() {
|
||||
<div className="panel chat-history">
|
||||
<h3>Messages</h3>
|
||||
{loading ? <p className="muted">Loading...</p> : null}
|
||||
{error ? <p className="error-text">{error}</p> : null}
|
||||
<ul className="list-reset">
|
||||
{messages.map((m) => (
|
||||
<li key={m.messageId} className="card" style={{ marginTop: 8 }}>
|
||||
@@ -298,6 +298,18 @@ export default function ChatPage() {
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{error ? (
|
||||
<div className="modal-backdrop" onClick={() => setError('')}>
|
||||
<div className="modal-card" onClick={(e) => e.stopPropagation()}>
|
||||
<h3>Error</h3>
|
||||
<p className="error-text">{error}</p>
|
||||
<div className="row-wrap" style={{ marginTop: 12 }}>
|
||||
<button className="btn" onClick={() => setError('')}>OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user