List signupees

This commit is contained in:
Aarni Halinen
2020-06-16 23:40:47 +03:00
parent 1911687a53
commit 8a10c6679e
2 changed files with 19 additions and 3 deletions
+1
View File
@@ -9,6 +9,7 @@ export interface SignupForm {
start_time: string;
end_time: string;
questions: Question[];
signups: string[];
}
export async function getForms(): Promise<SignupForm[]> {
+18 -3
View File
@@ -155,6 +155,7 @@ class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState> {
};
if (payload.id === undefined) {
const resp = await createSignup(payload);
this.fetchSignUp();
this.setState({
error: null,
statusMessage: "Sign-up submitted successfully",
@@ -200,23 +201,37 @@ class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState> {
);
}
renderList() {
const { signUpForm } = this.state;
return (
<div>
{signUpForm.signups.map(s => (
<p key={s}>{s}</p>
))}
</div>
)
}
render() {
const { match } = this.props;
const { id } = match.params;
const { signUpForm, statusMessage } = this.state;
const content = signUpForm !== null
const form = signUpForm !== null
? this.renderForm()
: <div>Loading...</div>;
const signups = signUpForm && signUpForm.signups ? this.renderList() : null;
return (
<div className="sign-up-page">
<Helmet>
<link rel="canonical" href={`https://sik.ayy.fi/signup/${id}`} />
</Helmet>
{statusMessage}
<PageSection backgroundColor={ColorEnum.DarkBlue}>
{statusMessage}
{content}
{form}
{signups}
</PageSection>
</div>
);