-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3d7d5d3
commit ce286ef
Showing
5 changed files
with
94 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { useEffect, useState } from "react" | ||
|
||
import api from 'tbot/twitch/api' | ||
|
||
export default function({ channelId, user }) { | ||
const [data, setData] = useState('') | ||
const [loading, setLoading] = useState(true) | ||
const [error, setError] = useState(false) | ||
|
||
useEffect(() => { | ||
setLoading(false) | ||
api.get(`/api/twitch/channels/${channelId}/user-akas`, {params: { | ||
user: user, | ||
}}).then(r => { | ||
setData(r.data) | ||
setError(false) | ||
}).catch((e) => { | ||
console.log(e) | ||
setData(null) | ||
setError(true) | ||
}).finally(() => { | ||
setLoading(false) | ||
}) | ||
}, [channelId, user]) | ||
|
||
if (loading) | ||
return <div></div> | ||
|
||
if (error) | ||
return <div></div> | ||
|
||
if (data?.length < 2) | ||
return <div></div> | ||
|
||
return <div style={{marginTop: '1rem'}}> | ||
<h3>AKAs</h3> | ||
<table className="table table-dark table-sm table-hover"> | ||
<tbody> | ||
{data.map(s => ( | ||
<tr key={s.stream_id}> | ||
<td | ||
className="fit-content" | ||
> | ||
{data['user']} | ||
</td> | ||
</tr> | ||
))} | ||
</tbody> | ||
</table> | ||
</div> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters