diff --git a/functions/handlers/users.js b/functions/handlers/users.js
index 84463c2..283b97b 100644
--- a/functions/handlers/users.js
+++ b/functions/handlers/users.js
@@ -415,16 +415,15 @@ exports.unverifyUser = (req, res) => {
});
};
exports.getUserHandles = (req, res) => {
- admin
- .firestore()
- .collection("users")
+ db.doc(`/users/${req.body.userHandle}`)
.get()
- .then(data => {
- let users = [];
- data.forEach(function(doc) {
- users.push(doc.data().handle);
- });
- return res.status(200).json(users);
+ .then(doc => {
+ if (doc.exists) {
+ let userHandle = doc.data().handle;
+ return res.status(200).json(userHandle);
+ } else {
+ return res.status(404).json({ error: "user not found" });
+ }
})
.catch(err => {
console.error(err);
diff --git a/functions/index.js b/functions/index.js
index eb87142..df44c82 100644
--- a/functions/index.js
+++ b/functions/index.js
@@ -56,7 +56,7 @@ app.post("/verifyUser", fbAuth, verifyUser);
app.post("/unverifyUser", fbAuth, unverifyUser);
// get user handles with search phase
-app.get("/getUserHandles", fbAuth, getUserHandles);
+app.post("/getUserHandles", fbAuth, getUserHandles);
// get user's subscription
app.get("/getSubs", fbAuth, getSubs);
diff --git a/twistter-frontend/src/components/layout/NavBar.js b/twistter-frontend/src/components/layout/NavBar.js
index 9c720b0..f1e1b4a 100644
--- a/twistter-frontend/src/components/layout/NavBar.js
+++ b/twistter-frontend/src/components/layout/NavBar.js
@@ -1,71 +1,84 @@
/* eslint-disable */
-import React, { Component } from 'react';
-import { Link } from 'react-router-dom';
-import PropTypes from 'prop-types';
+import React, { Component } from "react";
+import { Link } from "react-router-dom";
+import PropTypes from "prop-types";
// Material UI stuff
-import AppBar from '@material-ui/core/AppBar';
-import ToolBar from '@material-ui/core/Toolbar';
-import Button from '@material-ui/core/Button';
+import AppBar from "@material-ui/core/AppBar";
+import ToolBar from "@material-ui/core/Toolbar";
+import Button from "@material-ui/core/Button";
import withStyles from "@material-ui/core/styles/withStyles";
// Redux stuff
-import { logoutUser } from '../../redux/actions/userActions';
-import { connect } from 'react-redux';
+import { logoutUser } from "../../redux/actions/userActions";
+import { connect } from "react-redux";
const styles = {
- form: {
- textAlign: "center"
- },
- textField: {
- marginBottom: 30
- },
- pageTitle: {
- marginBottom: 40
- },
- button: {
- positon: "relative",
- marginBottom: 30
- },
- progress: {
- position: "absolute"
- }
- };
-
+ form: {
+ textAlign: "center"
+ },
+ textField: {
+ marginBottom: 30
+ },
+ pageTitle: {
+ marginBottom: 40
+ },
+ button: {
+ positon: "relative",
+ marginBottom: 30
+ },
+ progress: {
+ position: "absolute"
+ }
+};
+
export class Navbar extends Component {
- render() {
- const authenticated = this.props.user.authenticated;
- return (
-
searching...
+No result
); return ( @@ -65,6 +66,11 @@ export class Search extends Component { onChange={event => this.handleInput(event)} /> +