Skip to content

Commit fbb331c

Browse files
committed
added post
1 parent 34b9691 commit fbb331c

File tree

3 files changed

+121
-35
lines changed

3 files changed

+121
-35
lines changed

layouts/default.vue

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
class="mt-2"
5858
size="24"
5959
>
60-
<v-img :src="$store.state.usersData.profile_photo" />
60+
<v-img :src="$store.state.auth.user.profile_photo" />
6161
</v-avatar>
6262
</v-btn>
6363
</v-tabs>
@@ -104,14 +104,6 @@ export default {
104104
}
105105
]
106106
}
107-
},
108-
mounted () {
109-
this.getData()
110-
},
111-
methods: {
112-
getData () {
113-
this.$store.dispatch('getData')
114-
}
115107
}
116108
}
117109
</script>

pages/index.vue

Lines changed: 117 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
11
<template>
22
<v-container>
3+
<v-row justify="center">
4+
<v-dialog
5+
v-model="dialog"
6+
max-width="600px"
7+
>
8+
<v-card max-height="593">
9+
<v-textarea
10+
v-model="postItem"
11+
rows="8"
12+
required
13+
solo
14+
no-resize
15+
post-item
16+
/>
17+
<v-card-actions>
18+
<v-btn
19+
color="blue darken-1"
20+
text
21+
@click="postCreate"
22+
>
23+
Gönder
24+
</v-btn>
25+
</v-card-actions>
26+
</v-card>
27+
</v-dialog>
28+
</v-row>
329
<v-row>
430
<v-col>
531
<v-card
632
min-height="270"
733
max-width="225"
8-
class="mt-4 ml-4 justify-start elevation-0 card-border"
34+
class="mt-4 justify-start elevation-0 card-border fill-width"
935
>
1036
<v-avatar class="profile-image" size="68">
1137
<v-img
12-
:src="$store.state.usersData.profile_photo"
38+
:src="$store.state.auth.user.profile_photo"
1339
/>
1440
</v-avatar>
1541
<v-img
16-
:src="$store.state.usersData.banner_photo"
42+
:src="$store.state.auth.user.banner_photo"
1743
class="background-image"
1844
/>
1945
<v-card-title class="mt-8 align-center justify-center" style="font-size: 16px">
20-
{{ $store.state.usersData.first_name }} {{ $store.state.usersData.last_name }}
46+
{{ $store.state.auth.user.first_name }} {{ $store.state.auth.user.last_name }}
2147
</v-card-title>
2248

2349
<v-card-subtitle class="text-center" style="font-size: 12px">
24-
{{ $store.state.usersData.biography }}
50+
{{ $store.state.auth.user.biography }}
2551
</v-card-subtitle>
2652
<v-divider />
2753
<v-card-text style="font-size: 12px">
@@ -40,7 +66,7 @@
4066
<v-row>
4167
<v-avatar class="mt-3 ml-4" size="48">
4268
<v-img
43-
:src="$store.state.usersData.profile_photo"
69+
:src="$store.state.auth?.user.profile_photo"
4470
/>
4571
</v-avatar>
4672
<v-btn
@@ -50,6 +76,7 @@
5076
height="48"
5177
rounded
5278
color="rgba(102, 102, 102, 0.60)"
79+
@click="dialog = true"
5380
>
5481
<v-card-subtitle
5582
style="margin-left: -80%;font-weight: 400;color: Gray;text-transform: none"
@@ -86,16 +113,52 @@
86113
</v-card>
87114
<v-divider class="mb-2" />
88115
<v-card
89-
class="fill-height elevation-0 card-border"
116+
v-for="(item,i) in posts.results"
117+
:key="i"
118+
class="elevation-0 card-border mb-2"
90119
>
91-
içerik kısmı
120+
<div class="d-flex align-center">
121+
<v-avatar class="mt-3 ml-4" size="48">
122+
<v-img :src="item.user.profile_photo" />
123+
</v-avatar>
124+
<v-card-title style="font-size: 16px">
125+
{{ item.user.first_name }} {{ item.user.last_name }}
126+
</v-card-title>
127+
</div>
128+
<v-card-text style="color:black">
129+
{{ item.text }}
130+
</v-card-text>
131+
<v-divider class="mb-2" />
132+
<v-row>
133+
<v-col
134+
v-for="(bar,a) in likeBar"
135+
:key="a"
136+
>
137+
<v-btn
138+
text
139+
class="ml-1 mb-2"
140+
>
141+
<v-icon
142+
:color="bar.color"
143+
>
144+
{{ bar.icon }}
145+
</v-icon>
146+
<v-card-text
147+
style="color:rgba(102, 102, 102, 0.60)"
148+
class="text-capitalize pa-0 ml-1"
149+
>
150+
{{ bar.text }}
151+
</v-card-text>
152+
</v-btn>
153+
</v-col>
154+
</v-row>
92155
</v-card>
93156
</v-col>
94157

95158
<v-col>
96159
<v-card
97160
min-height="268"
98-
class="d-flex mt-4 mr-4 justify-start elevation-0 card-border"
161+
class="mt-4 mr-4 justify-start elevation-0 card-border"
99162
width="300"
100163
>
101164
Footer kısmı
@@ -112,6 +175,32 @@ export default {
112175
middleware: authControl,
113176
data () {
114177
return {
178+
dialog: false,
179+
postItem: '',
180+
posts: [],
181+
media_file: null,
182+
likeBar: [
183+
{
184+
icon: 'mdi-thumb-up-outline',
185+
color: 'grey',
186+
text: 'Beğen'
187+
},
188+
{
189+
icon: 'mdi-message-text-outline',
190+
color: 'grey',
191+
text: 'Yorum Yap'
192+
},
193+
{
194+
icon: 'mdi-sync',
195+
color: 'grey',
196+
text: 'Paylaş'
197+
},
198+
{
199+
icon: 'mdi-send-variant',
200+
color: 'grey',
201+
text: 'Gönder'
202+
}
203+
],
115204
postItems: [
116205
{
117206
icon: 'mdi-image-outline',
@@ -131,7 +220,26 @@ export default {
131220
]
132221
}
133222
},
223+
mounted () {
224+
this.postGet()
225+
},
134226
methods: {
227+
postGet () {
228+
this.$axios.$get(process.env.POSTS_URL)
229+
.then((response) => {
230+
this.posts = response
231+
})
232+
},
233+
postCreate () {
234+
const params = {
235+
text: this.postItem,
236+
media_file: this.media_file
237+
}
238+
this.$axios.$post('/api/pages/post/', params)
239+
this.postItem = ''
240+
this.media_file = null
241+
this.dialog = false
242+
},
135243
logout () {
136244
this.$auth.logout()
137245
.then(() => {

store/index.js

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,7 @@
1-
export const state = () => ({
2-
usersData: {}
3-
})
1+
export const state = () => ({})
42

5-
export const mutations = {
6-
setUserData (state, userData) {
7-
state.usersData = userData
8-
}
9-
}
3+
export const mutations = {}
104

11-
export const actions = {
12-
getData ({ commit }) {
13-
this.$auth.fetchUser()
14-
.then((response) => {
15-
commit('setUserData', response.data)
16-
})
17-
}
18-
19-
}
5+
export const actions = {}
206

217
export const getters = {}

0 commit comments

Comments
 (0)