store registered coaches in the store
This commit is contained in:
parent
600a42a12e
commit
abf6109d91
|
@ -2,7 +2,7 @@
|
|||
<section>
|
||||
<base-card>
|
||||
<h2>Register as a coach, now!</h2>
|
||||
<coach-form> </coach-form>
|
||||
<coach-form @save-data="saveData"> </coach-form>
|
||||
</base-card>
|
||||
</section>
|
||||
</template>
|
||||
|
@ -10,6 +10,11 @@
|
|||
import CoachForm from '../../components/coaches/CoachForm.vue';
|
||||
|
||||
export default {
|
||||
components: { CoachForm }
|
||||
components: { CoachForm },
|
||||
methods: {
|
||||
saveData(data) {
|
||||
this.$store.dispatch('coaches/registerCoach', data);
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
@ -1 +1,13 @@
|
|||
export default {};
|
||||
export default {
|
||||
registerCoach(context, data) {
|
||||
const coachData = {
|
||||
id: new Date().toISOString(),
|
||||
firstName: data.first,
|
||||
lastName: data.last,
|
||||
description: data.desc,
|
||||
rate: data.rate,
|
||||
areas: data.areas
|
||||
};
|
||||
context.commit('registerCoach', coachData);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1 +1,5 @@
|
|||
export default {};
|
||||
export default {
|
||||
registerCoach(state, payload) {
|
||||
state.coaches.push(payload);
|
||||
}
|
||||
};
|
||||
|
|
Reference in New Issue
Block a user