Remove list_name from API calls, use <ol> for listing signupees
This commit is contained in:
@@ -32,7 +32,7 @@ class OptionsWidget extends React.Component<OptionsWidgetProps, OptionsWidgetSta
|
||||
throw new SignupQuestionError(`Question widget type "${type}" not in types array.`);
|
||||
}
|
||||
|
||||
if (type === "text") {
|
||||
if (type === "text" || type === "email") {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ export const optionTypes = [
|
||||
"text",
|
||||
"radiobutton",
|
||||
"checkbox",
|
||||
"email"
|
||||
];
|
||||
|
||||
export class SignupQuestionError extends Error { }
|
||||
|
||||
@@ -6,7 +6,6 @@ export interface Signup {
|
||||
id?: number;
|
||||
signupForm_id: number;
|
||||
answer: string;
|
||||
list_name: string;
|
||||
}
|
||||
|
||||
export async function getSignup(id: number): Promise<Signup> {
|
||||
|
||||
@@ -75,6 +75,14 @@ class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState> {
|
||||
uniqueItems: true,
|
||||
};
|
||||
}
|
||||
else if (question.type === "email") {
|
||||
obj = {
|
||||
type: "string",
|
||||
title: question.name,
|
||||
format: "email",
|
||||
default: ""
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(`No mapping to schema prop for question type ${question.type}`);
|
||||
}
|
||||
@@ -151,7 +159,6 @@ class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState> {
|
||||
id: undefined,
|
||||
signupForm_id: signUpForm.id,
|
||||
answer: data.formData,
|
||||
list_name: data.formData[signUpForm.questions[0].id]
|
||||
};
|
||||
if (payload.id === undefined) {
|
||||
const resp = await createSignup(payload);
|
||||
@@ -204,11 +211,11 @@ class SignUpPage extends React.Component<SignUpPageProps, SignUpPageState> {
|
||||
renderList() {
|
||||
const { signUpForm } = this.state;
|
||||
return (
|
||||
<div>
|
||||
{signUpForm.signups.map(s => (
|
||||
<p key={s}>{s}</p>
|
||||
<ol>
|
||||
{signUpForm.signups.map((s, idx) => (
|
||||
<li key={idx}>{s}</li>
|
||||
))}
|
||||
</div>
|
||||
</ol>
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user