Skip to content

Commit

Permalink
Handle not found user case
Browse files Browse the repository at this point in the history
  • Loading branch information
AhmedHelalAhmed committed Mar 6, 2022
1 parent 88e4823 commit d581ca4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions public/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -20580,7 +20580,11 @@ var render = function () {
_vm.userLoading
? _c("p", [_vm._v("Loading user...")])
: _c("p", { staticClass: "text-2xl text-gray-100 ml-4" }, [
_vm._v(_vm._s(_vm.user.data.attributes.name)),
_vm._v(
_vm._s(
_vm.user ? _vm.user.data.attributes.name : "Not Found"
)
),
]),
]
),
Expand All @@ -20592,7 +20596,7 @@ var render = function () {
return _c("post", { key: post.data.post_id, attrs: { post: post } })
}),
_vm._v(" "),
!_vm.postsLoading && _vm.posts.length < 1
!_vm.postsLoading && (!_vm.posts || _vm.posts.length < 1)
? _c("p", [_vm._v("\n No posts found. Get Started...\n ")])
: _vm._e(),
],
Expand Down Expand Up @@ -38016,8 +38020,8 @@ __webpack_require__.r(__webpack_exports__);
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

__webpack_require__(/*! /var/www/html/facebook-clone-laravel/resources/js/app.js */"./resources/js/app.js");
module.exports = __webpack_require__(/*! /var/www/html/facebook-clone-laravel/resources/sass/app.scss */"./resources/sass/app.scss");
__webpack_require__(/*! /var/www/app/resources/js/app.js */"./resources/js/app.js");
module.exports = __webpack_require__(/*! /var/www/app/resources/sass/app.scss */"./resources/sass/app.scss");


/***/ })
Expand Down
4 changes: 2 additions & 2 deletions resources/js/views/Users/Show.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
class="w-32 h-32 object-cover border-4 border-gray-200 rounded-full shadow-lg">
</div>
<p v-if="userLoading">Loading user...</p>
<p v-else class="text-2xl text-gray-100 ml-4">{{ user.data.attributes.name }}</p>
<p v-else class="text-2xl text-gray-100 ml-4">{{ user ? user.data.attributes.name : 'Not Found' }}</p>
</div>
</div>
<p v-if="postsLoading">Loading posts...</p>
<post v-else v-for="post in posts" :post="post" :key="post.data.post_id"></post>
<p v-if="!postsLoading && posts.length <1 ">
<p v-if="!postsLoading && (!posts || posts.length <1) ">
No posts found. Get Started...
</p>
</div>
Expand Down

0 comments on commit d581ca4

Please sign in to comment.