Skip to content

Commit

Permalink
Merge pull request #334 from traPtitech/fix/router-link
Browse files Browse the repository at this point in the history
to属性でオブジェクトを使用するように変更
  • Loading branch information
dye8128 authored Jul 12, 2024
2 parents 19d53e6 + 2f5101d commit b97d71a
Show file tree
Hide file tree
Showing 22 changed files with 51 additions and 24 deletions.
5 changes: 4 additions & 1 deletion src/components/Contest/ContestTeamItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ const userNames = computed(() =>

<template>
<router-link
:to="`/contests/${contestId}/teams/${contestTeam.id}/edit`"
:to="{
name: 'ContestTeamEdit',
params: { contestId: contestId, teamId: contestTeam.id }
}"
:class="$style.link"
>
<div :class="$style.container">
Expand Down
2 changes: 1 addition & 1 deletion src/components/Contest/ContestTeams.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const filteredContestTeams = computed(() =>
</div>
<div>
<router-link
:to="`/contests/${contestId}/teams/new`"
:to="{ name: 'ContestTeamNew', params: { contestId: contestId } }"
:class="$style.link"
>
<base-button type="primary" icon="mdi:plus">New</base-button>
Expand Down
5 changes: 4 additions & 1 deletion src/components/Contests/ContestItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ defineProps<Props>()
</script>

<template>
<router-link :to="`/contests/${contest.id}`" :class="$style.link">
<router-link
:to="{ name: 'Contest', params: { contestId: contest.id } }"
:class="$style.link"
>
<div :class="$style.container">
<p :class="$style.name">{{ contest.name }}</p>
<p :class="$style.duration">
Expand Down
5 changes: 4 additions & 1 deletion src/components/Events/EventItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ onUnmounted(() => {

<template>
<div :class="$style.container">
<router-link :to="`events/${event.id}`" :class="$style.link">
<router-link
:to="{ name: 'Event', params: { id: event.id } }"
:class="$style.link"
>
<p :class="$style.name">{{ event.name }}</p>
<p :class="$style.duration">
<icon name="mdi:calendar" />
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/PageHeader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const { isMobile } = storeToRefs(useResponsiveStore())
<button v-if="isMobile" @click="emit('toggleNavigationBar')">
<icon name="mdi:menu" />
</button>
<router-link to="/">
<router-link :to="{ name: 'Index' }">
<img
src="/@/assets/traP_logo_blue.svg"
alt="traP"
Expand Down
5 changes: 4 additions & 1 deletion src/components/Projects/ProjectItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ defineProps<Props>()
</script>

<template>
<router-link :to="`/projects/${project.id}/edit`" :class="$style.link">
<router-link
:to="{ name: 'Project', params: { projectId: project.id } }"
:class="$style.link"
>
<div :class="$style.container">
<p :class="$style.name">{{ project.name }}</p>
<p :class="$style.duration">
Expand Down
2 changes: 1 addition & 1 deletion src/components/User/UserProfileDesktop.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ defineProps<Props>()
</div>
<div :class="$style.accounts">
<user-accounts :accounts="user.accounts" />
<router-link to="/user/accounts" :class="$style.link">
<router-link :to="{ name: 'UserAccounts' }" :class="$style.link">
<base-button icon="mdi:account">Edit</base-button>
</router-link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/User/UserProfileMobile.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ defineProps<Props>()
</div>
<div :class="$style.accounts">
<user-accounts :accounts="user.accounts" />
<router-link to="/user/accounts" :class="$style.link">
<router-link :to="{ name: 'UserAccounts' }" :class="$style.link">
<base-button icon="mdi:account">Edit</base-button>
</router-link>
</div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/UserAccounts/AccountItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ defineProps<Props>()
</script>

<template>
<router-link :to="`/user/accounts/${account.id}/edit`" :class="$style.link">
<router-link
:to="{ name: 'UserAccountsEdit', params: { accountId: account.id } }"
:class="$style.link"
>
<div :class="$style.container">
<div :class="$style.displayNameContainer">
<p :class="$style.displayName">{{ account.displayName }}</p>
Expand Down
7 changes: 5 additions & 2 deletions src/pages/Contest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ const contestTeams: ContestTeam[] = (
detail="コンテストの詳細です。"
:class="$style.header"
/>
<router-link :to="`/contests/${contestId}/edit`" :class="$style.link">
<router-link
:to="{ name: 'ContestEdit', params: { contestId: contestId } }"
:class="$style.link"
>
<base-button type="primary" icon="mdi:pencil">Edit</base-button>
</router-link>
</div>
Expand Down Expand Up @@ -70,7 +73,7 @@ const contestTeams: ContestTeam[] = (
</section>
</div>

<router-link to="/contests" :class="$style.link">
<router-link :to="{ name: 'Contests' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
5 changes: 4 additions & 1 deletion src/pages/ContestEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,10 @@ const deleteContest = async () => {
<delete-form target="コンテスト" @delete="open" />

<div :class="$style.buttonContainer">
<router-link :to="`/contests/${contestId}`" :class="$style.link">
<router-link
:to="{ name: 'Contest', params: { contestId: contestId } }"
:class="$style.link"
>
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ContestNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ const createContest = async () => {
</labeled-form>
</form>
<div :class="$style.buttonContainer">
<router-link to="/contests" :class="$style.link">
<router-link :to="{ name: 'Contests' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
5 changes: 4 additions & 1 deletion src/pages/ContestTeamEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,10 @@ const deleteContestTeam = async () => {
<delete-form target="コンテストチーム" @delete="open" />

<div :class="$style.buttonContainer">
<router-link :to="`/contests/${contestId}`" :class="$style.link">
<router-link
:to="{ name: 'Contest', params: { contestId: contestId } }"
:class="$style.link"
>
<base-button type="secondary" icon="mdi:arrow-left">Back</base-button>
</router-link>
<base-button
Expand Down
5 changes: 4 additions & 1 deletion src/pages/ContestTeamNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ const createContestTeam = async () => {
</form>

<div :class="$style.buttonContainer">
<router-link :to="`/contests/${contestId}`" :class="$style.link">
<router-link
:to="{ name: 'Contest', params: { contestId: contestId } }"
:class="$style.link"
>
<base-button type="secondary" icon="mdi:arrow-left">Back</base-button>
</router-link>
<base-button
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Contests.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const filteredContests = computed(() =>
/>
</div>
<div>
<router-link to="/contests/new" :class="$style.link">
<router-link :to="{ name: 'ContestNew' }" :class="$style.link">
<base-button type="primary" icon="mdi:trophy">New</base-button>
</router-link>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Event.vue
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ const updateEvent = async () => {
</div>

<div :class="$style.buttonContainer">
<router-link to="/events" :class="$style.link">
<router-link :to="{ name: 'Events' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Project.vue
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const handleDelete = (id: string) => {
</form>

<div :class="$style.buttonContainer">
<router-link :to="`/projects/${projectId}`" :class="$style.link">
<router-link :to="{ name: 'Projects' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ProjectNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const handleDelete = (id: string) => {
</labeled-form>
</form>
<div :class="$style.buttonContainer">
<router-link to="/projects" :class="$style.link">
<router-link :to="{ name: 'Projects' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Projects.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const filteredProjects = computed(() =>
/>
</div>
<div>
<router-link to="/projects/new" :class="$style.link">
<router-link :to="{ name: 'ProjectNew' }" :class="$style.link">
<base-button type="primary" icon="mdi:clipboard-file">
New</base-button
>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/UserAccountEdit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const deleteAccount = async () => {
<delete-form target="アカウント" @delete="open" />

<div :class="$style.buttonContainer">
<router-link to="/user/accounts" :class="$style.link">
<router-link :to="{ name: 'UserAccounts' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
2 changes: 1 addition & 1 deletion src/pages/UserAccountNew.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const createNewAccount = async () => {
</labeled-form>
</form>
<div :class="$style.buttonContainer">
<router-link to="/user/accounts" :class="$style.link">
<router-link :to="{ name: 'UserAccounts' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down
4 changes: 2 additions & 2 deletions src/pages/UserAccounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const me = (await apis.getMe()).data
detail="アカウント情報を変更します。"
:class="$style.header"
/>
<router-link to="/user/accounts/new" :class="$style.link">
<router-link :to="{ name: 'UserAccountsNew' }" :class="$style.link">
<base-button type="primary" icon="mdi:account">New</base-button>
</router-link>
</div>
Expand All @@ -32,7 +32,7 @@ const me = (await apis.getMe()).data
</li>
</ul>

<router-link to="/user" :class="$style.link">
<router-link :to="{ name: 'Profile' }" :class="$style.link">
<base-button
:class="$style.backButton"
type="secondary"
Expand Down

0 comments on commit b97d71a

Please sign in to comment.