Skip to content

Commit 68e2217

Browse files
committed
logoutの処理を修正
1 parent dddd4da commit 68e2217

File tree

5 files changed

+18
-17
lines changed

5 files changed

+18
-17
lines changed

src/layouts/classes.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ export default Vue.extend({
138138
this.loading = false
139139
},
140140
methods: {
141-
clickLogout() {
142-
vxm.classData.unloadClassData().then(() => {
143-
this.$router.push('/')
144-
})
141+
async clickLogout() {
142+
await vxm.user.logout()
143+
await vxm.app.resetDate()
144+
await this.$router.push('/')
145145
},
146146
},
147147
})

src/layouts/protected.vue

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,6 @@ export default Vue.extend({
140140
this.loading = false
141141
},
142142
methods: {
143-
signout() {
144-
vxm.user.logout()
145-
this.$router.push('/')
146-
},
147-
148143
unloadClassData() {
149144
vxm.classData.unloadClassData()
150145
},

src/pages/user/editUserData.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -220,14 +220,13 @@ export default Vue.extend<Data, Methods, Computed, unknown>({
220220
this.$router.push('/edit')
221221
},
222222
async doLogout(): Promise<void> {
223-
await Auth.signOut()
224-
.then(() => {
225-
vxm.user.logout()
226-
this.$router.push('/')
227-
})
228-
.catch(() => {
229-
this.error = true
230-
})
223+
try {
224+
await vxm.user.logout()
225+
await vxm.app.resetDate()
226+
await this.$router.push('/')
227+
} catch {
228+
this.error = true
229+
}
231230
},
232231
},
233232
})

src/pages/user/logout.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import Vue from 'vue'
1616
import BaseBottomSheetLayer from '@/components/BaseBottomSheetLayer.vue'
1717
import { Auth } from 'aws-amplify'
18+
import { vxm } from '@/store'
1819
1920
export default Vue.extend({
2021
components: { BaseBottomSheetLayer },
@@ -33,6 +34,7 @@ export default Vue.extend({
3334
this.loading = true
3435
try {
3536
await Auth.signOut()
37+
await vxm.app.resetDate()
3638
await this.$router.push('/')
3739
} catch {
3840
this.loading = false

src/store/modules/app.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,9 @@ export class AppStore extends VuexModule implements App {
3030
public setDate(date: Date) {
3131
this.currentDate = date
3232
}
33+
34+
@mutation
35+
public resetDate() {
36+
this.currentDate = new Date()
37+
}
3338
}

0 commit comments

Comments
 (0)