|
@@ -14,58 +14,68 @@ export default defineComponent({
|
|
|
return {
|
|
|
config,
|
|
|
data: null,
|
|
|
- videos: null
|
|
|
+ videos: null,
|
|
|
}
|
|
|
},
|
|
|
setup() {
|
|
|
const router = useRouter()
|
|
|
return { router }
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ '$route.params.id'(newId, oldId) {
|
|
|
+ this.data = null;
|
|
|
+ this.fetchData(newId)
|
|
|
+ }
|
|
|
+ },
|
|
|
created() {
|
|
|
- // Fetch account data //
|
|
|
- axios
|
|
|
- .get(`${config.serverURL}/account/${this.$route.params.id}/get`, {
|
|
|
- withCredentials: true,
|
|
|
- })
|
|
|
- .then((response) => {
|
|
|
- if (response.data.error)
|
|
|
- return (this.data = {
|
|
|
+ this.fetchData(this.$route.params.id);
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ fetchData(id) {
|
|
|
+ // Fetch account data //
|
|
|
+ axios
|
|
|
+ .get(`${config.serverURL}/account/${id}/get`, {
|
|
|
+ withCredentials: true,
|
|
|
+ })
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.error)
|
|
|
+ return (this.data = {
|
|
|
+ username: 'profile not found',
|
|
|
+ followers: 'profile not found',
|
|
|
+ following: 'profile not found',
|
|
|
+ })
|
|
|
+ this.data = response.data
|
|
|
+ console.log(this.data)
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ this.data = {
|
|
|
username: 'profile not found',
|
|
|
followers: 'profile not found',
|
|
|
following: 'profile not found',
|
|
|
- })
|
|
|
- this.data = response.data
|
|
|
- console.log(this.data)
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- this.data = {
|
|
|
- username: 'profile not found',
|
|
|
- followers: 'profile not found',
|
|
|
- following: 'profile not found',
|
|
|
- }
|
|
|
-
|
|
|
- console.error('Error in getting profile id ' + this.$route.params.id + '!')
|
|
|
- console.error(error)
|
|
|
- })
|
|
|
-
|
|
|
- // Fetch video data //
|
|
|
- axios
|
|
|
- .get(`${config.serverURL}/account/${this.$route.params.id}/videos`, {
|
|
|
- withCredentials: true,
|
|
|
- })
|
|
|
- .then((response) => {
|
|
|
- if (response.data.error) return (this.videos = [])
|
|
|
- this.videos = response.data
|
|
|
- console.log(this.videos)
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- this.videos = []
|
|
|
-
|
|
|
- console.error('Error in getting profile id ' + this.$route.params.id + ' videos!')
|
|
|
- console.error(error)
|
|
|
- })
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ }
|
|
|
+
|
|
|
+ console.error('Error in getting profile id ' + id + '!')
|
|
|
+ console.error(error)
|
|
|
+ })
|
|
|
+
|
|
|
+ // Fetch video data //
|
|
|
+ axios
|
|
|
+ .get(`${config.serverURL}/account/${id}/videos`, {
|
|
|
+ withCredentials: true,
|
|
|
+ })
|
|
|
+ .then((response) => {
|
|
|
+ if (response.data.error) return (this.videos = [])
|
|
|
+ this.videos = response.data
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ this.videos = []
|
|
|
+
|
|
|
+ console.error(
|
|
|
+ 'Error in getting profile id ' + id + ' videos!',
|
|
|
+ )
|
|
|
+ console.error(error)
|
|
|
+ })
|
|
|
+ },
|
|
|
openBio() {
|
|
|
document.getElementById('bio-container').classList.remove('hidden')
|
|
|
},
|
|
@@ -75,7 +85,7 @@ export default defineComponent({
|
|
|
signedIn() {
|
|
|
return Cookies.get('token') && Cookies.get('token').startsWith('HajeebToken')
|
|
|
},
|
|
|
- }
|
|
|
+ },
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -99,7 +109,13 @@ export default defineComponent({
|
|
|
<button class="india-button">follow</button>
|
|
|
<button class="india-button">message</button>
|
|
|
<span v-if="this.data">
|
|
|
- <button class="india-button" v-if="this.data.myself" @click="this.router.push('/upload')">upload</button>
|
|
|
+ <button
|
|
|
+ class="india-button"
|
|
|
+ v-if="this.data.myself"
|
|
|
+ @click="this.router.push('/upload')"
|
|
|
+ >
|
|
|
+ upload
|
|
|
+ </button>
|
|
|
</span>
|
|
|
<span v-else>loading</span>
|
|
|
</span>
|
|
@@ -132,7 +148,11 @@ export default defineComponent({
|
|
|
</div>
|
|
|
|
|
|
<div class="profile-videos">
|
|
|
- <ProfileVideo :id="video.id" v-for="video in videos" />
|
|
|
+ <ProfileVideo
|
|
|
+ :account-id="$route.params.id"
|
|
|
+ :id="video.id"
|
|
|
+ v-for="video in videos"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -140,7 +160,7 @@ export default defineComponent({
|
|
|
<div class="bio-panel">
|
|
|
<button class="india-button bio-text" @click="closeBio">close</button>
|
|
|
<div class="profile-links" v-if="this.data" v-for="link in this.data.links">
|
|
|
- <a :href="link.url" class="profile-link">{{link.url}}</a>
|
|
|
+ <a :href="link.url" class="profile-link">{{ link.url }}</a>
|
|
|
</div>
|
|
|
<div v-else>loading</div>
|
|
|
<p v-if="this.data">{{ this.data.bio }}</p>
|
|
@@ -190,11 +210,12 @@ export default defineComponent({
|
|
|
}
|
|
|
|
|
|
.profile-videos {
|
|
|
- display: grid;
|
|
|
- grid-auto-flow: row;
|
|
|
- grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
|
|
|
+ flex-grow: 1;
|
|
|
+ display: flex;
|
|
|
+ flex-wrap: wrap;
|
|
|
gap: 16px;
|
|
|
padding: 16px;
|
|
|
+ overflow-y: scroll;
|
|
|
}
|
|
|
|
|
|
.profile-row {
|