Skip to content

Commit

Permalink
done with shit
Browse files Browse the repository at this point in the history
  • Loading branch information
jackbader committed Oct 11, 2017
1 parent 0b0a192 commit 100b830
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 20 deletions.
2 changes: 1 addition & 1 deletion public/createItem.html
Expand Up @@ -48,7 +48,7 @@
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li class="firstNavItem"></li>
<li class="secondNavItem"></li>
<li><a href="userProfile.html"><i class="material-icons prefix">account_circle</i></a></li>
<li><a id='profileButton'><i class="material-icons prefix">account_circle</i></a></li>
</ul>
</div>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion public/item.html
Expand Up @@ -42,7 +42,7 @@
<li class = "firstNavItem"></li>
<li class = "secondNavItem"></li>
<li class = "editNavItem"></li>
<li><a href="userProfile.html"><i class="material-icons prefix">account_circle</i></a></li>
<li><a id='profileButton'><i class="material-icons prefix">account_circle</i></a></li>
</ul>
</div>
</nav>
Expand Down
2 changes: 1 addition & 1 deletion public/itemEdit.html
Expand Up @@ -43,7 +43,7 @@
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li class="firstNavItem"></li>
<li class="secondNavItem"></li>
<li><a href="userProfile.html"><i class="material-icons prefix">account_circle</i></a></li>
<li><a id='profileButton'><i class="material-icons prefix">account_circle</i></a></li>
</ul>
</div>
</nav>
Expand Down
16 changes: 0 additions & 16 deletions public/js/main.js
Expand Up @@ -4,22 +4,6 @@ $(document).ready(() => {

$('#myInput').val('')

$('#profileButton').click(function() {


$.getJSON('/token')
.done((data) => {
if (data.hasToken === false) {
Materialize.toast('You must be logged in to view that!', 3000);
} else {
window.location.href = `/userProfile.html?id=${data.cookies.userId}`;
}
console.log(data.hasToken)
})

console.log('test')
})


const slick = function () {
$.getJSON('/items')
Expand Down
16 changes: 16 additions & 0 deletions public/js/nav.js
Expand Up @@ -4,6 +4,22 @@ $(document).ready(() => {

console.log('ready test')

$('#profileButton').click(function() {


$.getJSON('/token')
.done((data) => {
if (data.hasToken === false) {
Materialize.toast('You must be logged in to view that!', 3000);
} else {
window.location.href = `/userProfile.html?id=${data.cookies.userId}`;
}
console.log(data.hasToken)
})

console.log('test')
})

$.getJSON('/token')
.done((data) => {
const $firstNavItems = $('.firstNavItem');
Expand Down
4 changes: 4 additions & 0 deletions public/stylesheets/userSignIn.css
Expand Up @@ -3,3 +3,7 @@ body {
width: 100%;
/*background-color: red;*/
}

nav {
background-color: #6BBA54 !important;
}
4 changes: 4 additions & 0 deletions public/stylesheets/userSignup.css
Expand Up @@ -3,3 +3,7 @@ body {
width: 100%;
/*background-color: red;*/
}

nav {
background-color: #6BBA54 !important;
}
1 change: 1 addition & 0 deletions public/userProfile.html
Expand Up @@ -47,6 +47,7 @@
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li class="firstNavItem"></li>
<li class="secondNavItem"></li>
<li><a id='profileButton'><i class="material-icons prefix">account_circle</i></a></li>
</ul>
</div>
</nav>
Expand Down
4 changes: 4 additions & 0 deletions public/userSignUp.html
Expand Up @@ -22,6 +22,7 @@

<!-- my js -->
<script src = "js/signup.js"></script>
<script src = "js/nav.js"></script>

<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
Expand All @@ -40,6 +41,9 @@
<div class="nav-wrapper">
<a href="index.html" class="brand-logo">Logo</a>
<ul id="nav-mobile" class="right hide-on-med-and-down">
<li class="firstNavItem"></li>
<li class="secondNavItem"></li>
<li><a id='profileButton'><i class="material-icons prefix">account_circle</i></a></li>
</ul>
</div>
</nav>
Expand Down
3 changes: 2 additions & 1 deletion routes/token.js
Expand Up @@ -41,10 +41,11 @@ router.post('/token', (req, res, next) => {

knex('users')
.where('email', email)
.orWhere('username', email)
.first()
.then((row) => {
if (!row) {
throw boom.create(400, 'Bad email or password');
throw Materialize.toast('Bad email or password', 3000);
}

user = camelizeKeys(row);
Expand Down

0 comments on commit 100b830

Please sign in to comment.