mirror of
https://github.com/mgerb/go-discord-bot
synced 2026-01-11 01:22:48 +00:00
audio clips - client done
This commit is contained in:
46
client/app/pages/Clips/Clips.tsx
Normal file
46
client/app/pages/Clips/Clips.tsx
Normal file
@@ -0,0 +1,46 @@
|
||||
import React from 'react';
|
||||
import axios from 'axios';
|
||||
|
||||
import { SoundList, SoundType } from '../../components/SoundList';
|
||||
|
||||
interface Props {}
|
||||
|
||||
interface State {
|
||||
clipList: SoundType[];
|
||||
}
|
||||
|
||||
export class Clips extends React.Component<Props, State> {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
clipList: [],
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.getClipList();
|
||||
}
|
||||
|
||||
private getClipList() {
|
||||
axios
|
||||
.get('/api/cliplist')
|
||||
.then(response => {
|
||||
this.setState({
|
||||
clipList: response.data,
|
||||
});
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.error(error.response.data);
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="Soundboard">
|
||||
<div className="column">
|
||||
<SoundList soundList={this.state.clipList} type="Clips"/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
1
client/app/pages/Clips/index.ts
Normal file
1
client/app/pages/Clips/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './Clips';
|
||||
Reference in New Issue
Block a user