Permalink
Browse files

Create meeting.

  • Loading branch information...
dblock committed Jul 9, 2018
1 parent ce83265 commit b79e65ea0bb7bc1f6f3974004069a01588a7928d
Showing with 45 additions and 9 deletions.
  1. +28 −0 app/mutations/CreateMeetingMutation.js
  2. +17 −9 app/screens/Record.js
@@ -0,0 +1,28 @@
import { graphql } from 'react-relay'
import commitMutation from 'relay-commit-mutation-promise'

const mutation = graphql`
mutation CreateMeetingMutation($input: createMeetingInput!) {
createMeeting(input: $input) {
meeting {
id
title
started
finished
}
}
}
`

function commit({ environment, input }) {
const variables = { input }

return commitMutation(environment, {
mutation,
variables
})
}

export default {
commit
}
@@ -4,18 +4,21 @@ import { StyleSheet, View, Text, SafeAreaView, Button, ScrollView } from 'react-
import HideableView from 'react-native-hideable-view';
import Icon from 'react-native-vector-icons/Ionicons';

import TimerMachine from 'react-timer-machine'
import TimerMachine from 'react-timer-machine';
import moment from "moment";
import momentDurationFormatSetup from "moment-duration-format";
momentDurationFormatSetup(moment);

import CreateMeetingMutation from '../mutations/CreateMeetingMutation';
import environment from '../Environment'

export default class Record extends React.Component {
constructor(props) {
super(props)
this.state = {
isMeetingStarted: false,
meetingStartedAt: null
}
}
}

startMeeting() {
@@ -24,13 +27,18 @@ export default class Record extends React.Component {

stopMeeting() {
this.setState({ isMeetingStarted: false, meetingStartedAt: null })

const meeting = {
startDateTime: this.state.meetingStartedAt,
endDateTime: new Date()
}

this.props.navigation.navigate('Main')
CreateMeetingMutation.commit({
environment,
input: {
title: 'Untitled Meeting',
started: this.state.meetingStartedAt,
finished: new Date()
}
}).then(response => {
this.props.navigation.navigate('Main')
}).catch(error => {
alert(error.message);
});
}

toggleMeeting() {

0 comments on commit b79e65e

Please sign in to comment.