Skip to content

Commit

Permalink
Add onsubmit func
Browse files Browse the repository at this point in the history
  • Loading branch information
josephspurrier committed Mar 29, 2020
1 parent 4c08074 commit 31bada3
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/app/api/static/app/src/page/Login.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
var m = require('mithril')
var Submit = require('../module/Submit')
var Sleep = require('../module/Sleep')
var User = require('../store/User')

var data = {
title: 'Login',
subtitle: 'Enter your login information below.'
}

function onSubmit(e) {
Submit.start(e)

Sleep(500).then(() => {
User.save().then(() => {
m.route.set('/list')
}).catch(function (e){
alert('Could not save content.',e)
}).finally(function() {
Submit.finish()
})
})
}

module.exports = {
view: () =>
<main>
Expand All @@ -16,7 +33,7 @@ module.exports = {
</div>

<div class="container" style="margin-top: 1em;">
<form name="login">
<form name="login" onsubmit={onSubmit}>

<div class="field">
<label class="label">Email</label>
Expand Down

0 comments on commit 31bada3

Please sign in to comment.