diff --git a/.eslintrc.js b/.eslintrc.ts similarity index 100% rename from .eslintrc.js rename to .eslintrc.ts diff --git a/Dockerfile b/Dockerfile index 88c93bd..9a9f60f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,4 @@ -# M1 Macの場合 # FROM arm64v8/node:16-alpine -# Intel CPUの場合 FROM node:16-alpine ARG WORKDIR @@ -15,6 +13,4 @@ RUN apk update && \ apk add --no-cache python3 make g++ && \ apk add git -COPY package*.json ./ - COPY . ./ \ No newline at end of file diff --git a/components/Header.vue b/components/Header.vue index 84e678d..6b33925 100644 --- a/components/Header.vue +++ b/components/Header.vue @@ -1,5 +1,10 @@ diff --git a/pages/discord.vue b/pages/discord.vue index c4f970e..4999438 100644 --- a/pages/discord.vue +++ b/pages/discord.vue @@ -16,7 +16,22 @@ import { authStore } from '@/store' } }) export default class Discord extends Vue { + get getUser() { + return authStore.getUser + } + mounted() { + this.$gtag('config', process.env.GOOGLE_ANALYTICS_ID, { + user_id: this.getUser.id + }) + this.$gtag('set', 'user_properties', { + crm_id: this.getUser.id + }) + this.$gtag('event', 'done_auth', { + user_name: this.getUser.name, + user_display_name: this.getUser.display_name + }) + this.$router.push('/') } } diff --git a/pages/login.vue b/pages/login.vue index 5b4e1c3..ecd35a9 100644 --- a/pages/login.vue +++ b/pages/login.vue @@ -38,6 +38,7 @@ import { authStore } from '@/store' export default class Login extends Vue { authDiscord() { authStore.authDiscord() + this.$gtag('event', 'login_button_auth') } backPage() { diff --git a/pages/works/_id/edit.vue b/pages/works/_id/edit.vue index 2027f93..1121ec3 100644 --- a/pages/works/_id/edit.vue +++ b/pages/works/_id/edit.vue @@ -17,12 +17,19 @@ import BlockUnloadMixin from '~/mixins/BlockUnloadMixin' WorksForm }, middleware: 'auth_check', - async asyncData({ route }) { + async asyncData({ route, store, error }) { let resWork resWork = await AxiosClient.client('GET', `/works/${route.params.id}`, true) if (!resWork.data) { console.error(resWork.status) } + if (resWork.data.user.id !== store.state.auth.user.id) { + console.error('他人の作品は編集できません') + throw error({ + statusCode: 403, + message: '他人の作品は編集できません' + }) + } return { putWorkData: resWork.data } } }) diff --git a/pages/works/_id/index.vue b/pages/works/_id/index.vue index 9c4b677..c920c7f 100644 --- a/pages/works/_id/index.vue +++ b/pages/works/_id/index.vue @@ -1,6 +1,6 @@