Skip to content

Commit fad3235

Browse files
committed
Remember the user's selected phone
1 parent 94b6134 commit fad3235

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

web/pages/threads/_id/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ export default Vue.extend({
381381
},
382382
383383
async loadData() {
384+
await this.$store.dispatch('loadUser')
384385
await this.$store.dispatch('loadPhones')
385386
await this.$store.dispatch('loadThreads')
386387

web/pages/threads/index.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
4040
methods: {
4141
async loadData() {
42+
await this.$store.dispatch('loadUser')
4243
await this.$store.dispatch('loadPhones')
4344
await this.$store.dispatch('loadThreads')
4445
},

web/store/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,15 @@ export const actions = {
318318

319319
const response = await axios.get('/v1/phones', { params: { limit: 100 } })
320320
context.commit('setPhones', response.data.data)
321+
322+
if (context.state.user && context.state.user.active_phone_id) {
323+
const phone = response.data.data.find(
324+
(x: Phone) => x.id === context.state.user?.active_phone_id
325+
)
326+
if (phone) {
327+
context.commit('setOwner', phone.phone_number)
328+
}
329+
}
321330
},
322331

323332
async loadUser(context: ActionContext<State, State>) {

0 commit comments

Comments
 (0)