Skip to content

Commit

Permalink
Merge pull request #55 from bikingbadger/44-submit-form
Browse files Browse the repository at this point in the history
Form submition changes
  • Loading branch information
bikingbadger authored Jun 30, 2020
2 parents 69731ba + f1eebc1 commit 5a19a72
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/components/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export default {
const resp = await fetch(this.url);
// Store the json values into the
this.weightData = await resp.json();
// Check if there is any data, if there isn't then exit the function
if (this.weightData.length === 0) return;
this.pvOptions = {
xaxis: {
type: 'datetime',
Expand Down
18 changes: 9 additions & 9 deletions src/components/Weight.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<!-- opacity-0 pointer-events-none -->
<div
<form v-on:submit="createWeight"
class="grid justify-center md:border-2 rounded border-blue-500 p-4 md:mx-32 gap-4 text-sm md:text-xl"
>
<!-- <div
Expand Down Expand Up @@ -93,11 +93,11 @@
/>
</div>
<div class="button-item span-across">
<button @click="createWeight">
<button @click.prevent="createWeight">
Add weight
</button>
</div>
</div>
</form>
</template>

<script>
Expand All @@ -106,12 +106,12 @@ const url = '/.netlify/functions/weight-create';
export default {
data: () => ({
weightDate: '',
weightKilograms: 0.0,
fatPercent: 0.0,
weightBone: 0.0,
waterPercent: 0.0,
weightMuscle: 0.0,
bellyIndex: 0.0,
weightKilograms: null,
fatPercent: null,
weightBone: null,
waterPercent: null,
weightMuscle: null,
bellyIndex: null,
}),
methods: {
createWeight: function() {
Expand Down

0 comments on commit 5a19a72

Please sign in to comment.