diff --git a/twistter-frontend/src/pages/otherUser.js b/twistter-frontend/src/pages/otherUser.js
index 14b3b40..5c4c177 100644
--- a/twistter-frontend/src/pages/otherUser.js
+++ b/twistter-frontend/src/pages/otherUser.js
@@ -179,24 +179,33 @@ class user extends Component {
})
.catch(err => console.log(err));
- axios
- .get("/getAlert")
- .then(res => {
- let temp = this.state.posts;
- // console.log(res.data);
- res.data.forEach(element => {
- element ? temp.push(element) : console.err;
- });
- // temp.push(res.data[0]);
- this.setState({
- posts: temp
+ // Only add Admin posts if this is not the Admin account
+ let alertPromise;
+ if (this.state.profile !== "Admin") {
+ alertPromise = axios
+ .get("/getAlert")
+ .then(res => {
+ let temp = this.state.posts;
+ // console.log(res.data);
+ res.data.forEach(element => {
+ element ? temp.push(element) : console.err;
+ });
+ // temp.push(res.data[0]);
+ this.setState({
+ posts: temp
+ });
+ })
+ .catch(function(err) {
+ console.log(err);
});
+ } else {
+ alertPromise = new Promise((resolve, reject) => {
+ resolve();
})
- .catch(function(err) {
- console.log(err);
- });
+ }
+
- Promise.all([otherUserPromise, userPromise, posts])
+ Promise.all([otherUserPromise, userPromise, posts, alertPromise])
.then(() => {
this.setState({ loading: false });
})
@@ -245,14 +254,14 @@ class user extends Component {
this.state.myTopics.includes(topic) ? (
}
/>
) : (
this.handleAdd(topic)}
@@ -275,7 +284,7 @@ class user extends Component {
//(this.state.posts);
let postMarkup = this.state.posts ? (
this.state.posts.map(post => (
-
+
{this.state.imageUrl ? (
@@ -284,7 +293,7 @@ class user extends Component {
)}
-
+
{post.userHandle}
@@ -320,7 +329,7 @@ class user extends Component {
style={{ marginTop: "300px" }}
>
) : (
-
+
{imageMarkup}
{profileMarkup}