File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
frontend/src/components/app/users Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change 11<template >
22 <!-- eslint-disable max-len -->
33 <div class =" sm:mx-16 lg:mx-32" >
4- <div v-if =" !user" class =" mx-auto flex items-center justify-center mt-32" >
4+ <div v-if =" error" class =" mx-auto flex items-center justify-center mt-32" >
5+ {{error}}
6+ </div >
7+ <div v-if =" !user && !error" class =" mx-auto flex items-center justify-center mt-32" >
58 <img class =" h-36" src =" ../../../assets/loading.svg" >
69 </div >
7- <section v-else class =" mx-auto" >
10+ <section v-if = " user && !error " class =" mx-auto" >
811 <div v-on:click =" goBack()" class =" sort-button py-0 ml-auto rounded-md text-lg w-20 md:w-16 mr-4 sm:mr-0 mb-4" >
912 <h1 class =" noSelect" >←</h1 >
1013 </div >
@@ -26,6 +29,7 @@ export default {
2629 },
2730 data : () => ({
2831 user: null ,
32+ error: null ,
2933 }),
3034 methods: {
3135 goBack () {
@@ -39,8 +43,12 @@ export default {
3943 },
4044 },
4145 async beforeMount () {
42- const userRequest = await this .$http .get (` /profile/view/${ this .$route .params .id } ` );
43- this .user = userRequest .data .profile ;
46+ try {
47+ const userRequest = await this .$http .get (` /profile/view/${ this .$route .params .id } ` );
48+ this .user = userRequest .data .profile ;
49+ } catch (error) {
50+ this .error = error .response .data .error .message ;
51+ }
4452 },
4553};
4654 </script >
You can’t perform that action at this time.
0 commit comments