Skip to content

Commit 1d3f511

Browse files
authored
Merge pull request #419 from kaizumaki/aws-migration
isLoginWithAPIKEYをstoreから削除
2 parents 31338ce + ba649e3 commit 1d3f511

File tree

6 files changed

+16
-20
lines changed

6 files changed

+16
-20
lines changed

src/pages/classes/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ export default Vue.extend({
5959
},
6060
watch: {
6161
async currentDate() {
62-
await this.classData.getLessonsByCurrentDate()
62+
await this.classData.getLessonsByCurrentDateAuthModeAPIKEY()
6363
},
6464
},
6565
async mounted() {
66-
await this.classData.getLessonsByCurrentDate()
66+
await this.classData.getLessonsByCurrentDateAuthModeAPIKEY()
6767
},
6868
})
6969
</script>

src/pages/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ export default Vue.extend({
145145
async loginToClass() {
146146
this.loading = true
147147
try {
148-
await vxm.user.setAuthModeIsAPIKEY(true)
149148
const result = (await API.graphql({
150149
query: getClass,
151150
variables: { id: this.classId },

src/pages/lesson/index.vue

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,9 @@ export default Vue.extend({
238238
},
239239
},
240240
async mounted() {
241-
const lessonList = vxm.user.isLoginWithAPIKEY
242-
? await vxm.classData.lessonsOnCurrentDateAuthModeAPIKEY(
243-
vxm.app.currentDate
244-
)
245-
: await vxm.classData.lessonsOnCurrentDate(vxm.app.currentDate)
241+
const lessonList = await vxm.classData.lessonsOnCurrentDateAuthModeAPIKEY(
242+
vxm.app.currentDate
243+
)
246244
await this.$nextTick(function () {
247245
const data: LessonWithId | undefined = lessonList.find(
248246
(e) => this.$route.query.lessonId === e.id

src/pages/user/editUserData.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ type Computed = {
125125
export default Vue.extend<Data, Methods, Computed, unknown>({
126126
components: { BaseBottomSheetLayer, BaseActionButton, BaseInputField },
127127
layout: 'background',
128+
middleware: 'authenticated',
128129
data() {
129130
return {
130131
name: vxm.user.displayName,

src/store/modules/classData.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
mutation,
66
} from 'vuex-class-component'
77
import { AppStore } from '@/store/modules/app'
8-
import { UserStore } from '@/store/modules/user'
98
import classData from '@/types/store/classData'
109
import { API, Auth, graphqlOperation } from 'aws-amplify'
1110
import { GRAPHQL_AUTH_MODE, GraphQLResult } from '@aws-amplify/api'
@@ -227,10 +226,16 @@ export class ClassDataStore extends VuexModule implements classData.ClassData {
227226
@action
228227
public async getLessonsByCurrentDate() {
229228
const appStore = createProxy(this.$store, AppStore)
230-
const userStore = createProxy(this.$store, UserStore)
231-
const lessons = userStore.isLoginWithAPIKEY
232-
? await this.lessonsOnCurrentDateAuthModeAPIKEY(appStore.currentDate)
233-
: await this.lessonsOnCurrentDate(appStore.currentDate)
229+
const lessons = await this.lessonsOnCurrentDate(appStore.currentDate)
230+
await this.setLessonsGroupByPeriod(lessons)
231+
}
232+
233+
@action
234+
public async getLessonsByCurrentDateAuthModeAPIKEY() {
235+
const appStore = createProxy(this.$store, AppStore)
236+
const lessons = await this.lessonsOnCurrentDateAuthModeAPIKEY(
237+
appStore.currentDate
238+
)
234239
await this.setLessonsGroupByPeriod(lessons)
235240
}
236241

src/store/modules/user.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ export class UserStore extends VuexModule implements User {
3535
emailVerified: EmailVerified = false
3636
displayName: DisplayName = ''
3737
uid: Uid = ''
38-
isLoginWithAPIKEY: LoginWithAPIKEY = false
3938

4039
public get isAuthenticated(): Promise<boolean> {
4140
return (async () => {
@@ -53,11 +52,6 @@ export class UserStore extends VuexModule implements User {
5352
this.uid = uid
5453
}
5554

56-
@mutation
57-
public setAuthModeIsAPIKEY(isLoginWithAPIKEY: LoginWithAPIKEY) {
58-
this.isLoginWithAPIKEY = isLoginWithAPIKEY
59-
}
60-
6155
@action
6256
public async login() {
6357
const user = await Auth.currentAuthenticatedUser()
@@ -88,6 +82,5 @@ export class UserStore extends VuexModule implements User {
8882
emailVerified: false,
8983
displayName: '',
9084
})
91-
this.isLoginWithAPIKEY = false
9285
}
9386
}

0 commit comments

Comments
 (0)