Skip to content

Commit

Permalink
feat: add actions for waitlist feature
Browse files Browse the repository at this point in the history
  • Loading branch information
DominusKelvin committed Nov 15, 2024
1 parent 0b02dd7 commit 2629e22
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions templates/ascent-react/api/controllers/waitlist/join-waitlist.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module.exports = {
friendlyName: 'Join waitlist',

description: '',

inputs: {
email: {
type: 'string',
required: true,
isEmail: true,
maxLength: 200
}
},

exits: {
success: {
responseType: 'redirect',
description: 'Successfully joined waitlist'
},
badRequest: {
description: 'The provided email address is invalid.',
responseType: 'badRequest'
}
},

fn: async function ({ email }) {
await Waitlist.create({ email }).intercept('E_UNIQUE', 'badRequest')
return '/'
}
}

0 comments on commit 2629e22

Please sign in to comment.