Skip to content

Commit

Permalink
Some error handling in server.
Browse files Browse the repository at this point in the history
  • Loading branch information
RakhithaRR committed Mar 2, 2018
1 parent a56589d commit 49e2c7b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 41 deletions.
69 changes: 35 additions & 34 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions Client/src/components/Projects/ViewProjects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,23 @@
:key="`${index}`"
>
<v-card-title>
<v-flex md9>
<v-flex md9 xs12>
<h2>{{task.taskName}}</h2>
</v-flex>
<v-flex md3>
<v-btn fab dark small color="dark">
<v-icon dark>mdi-check</v-icon>
<v-flex md9 xs12>
<p class="subheading">{{new Date(task.deadline).toDateString()}}</p>
</v-flex>
<v-flex md9 xs12>
<p class="body-2">Assigned user: {{task.user}}</p>
</v-flex>
<v-flex md2>
<v-btn>
Mark as completed
</v-btn>
</v-flex>
<v-flex md1>
<v-icon color="green">mdi-check-circle</v-icon>
</v-flex>
</v-card-title>
</v-card>
</v-flex>
Expand Down
6 changes: 3 additions & 3 deletions Server/routes/project.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const firebase = require('../database/database');
//getting the details of all the users in the system
router.get('/getUsers', (req, res, next) => {
var userRef = firebase.database.ref('users');
userRef.orderByChild("Type").equalTo('Admin').on("value", (snapshot) => {
userRef.orderByChild("Type").equalTo('Admin').once("value", (snapshot) => {
// console.log(snapshot.val());
res.send(snapshot.val())
})
Expand Down Expand Up @@ -42,14 +42,14 @@ router.post('/addProject', (req, res, next) => {
//getting the list of all the projects available in the system
router.get('/getProjects', (req, res, next) => {
var projRef = firebase.database.ref('projects');
projRef.on("value", (snapshot) => {
projRef.once("value", (snapshot) => {
res.send(snapshot.val());
});
});

router.post('/getCurrentProject', (req, res, next) => {
var projRef = firebase.database.ref('projects');
projRef.orderByChild('Name').equalTo(req.body.name).on("value", (snapshot) => {
projRef.orderByChild('Name').equalTo(req.body.name).once("value", (snapshot) => {
var key = Object.keys(snapshot.val())[0];
res.json({successs: true, project: snapshot.val(), key: key});
})
Expand Down

0 comments on commit 49e2c7b

Please sign in to comment.