Create basic film page
This commit is contained in:
@@ -24,7 +24,7 @@ describe("Film", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe(
|
expect(wrapper.findComponent(RouterLinkStub).props().to).toBe(
|
||||||
`/film/${mockFilms[0].id}`
|
`/films/${mockFilms[0].id}`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,7 +28,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<router-link
|
<router-link
|
||||||
class="rounded font-semibold bg-gray-400 py-2 px-4 border-b-4 border-gray-500"
|
class="rounded font-semibold bg-gray-400 py-2 px-4 border-b-4 border-gray-500"
|
||||||
:to="`/film/${film.id}`"
|
:to="`/films/${film.id}`"
|
||||||
tag="button"
|
tag="button"
|
||||||
>
|
>
|
||||||
Read more
|
Read more
|
||||||
|
|||||||
28
pages/films/_id.vue
Normal file
28
pages/films/_id.vue
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
{{ film }}
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "Film",
|
||||||
|
head: {
|
||||||
|
titleTemplate: "%s - Film"
|
||||||
|
},
|
||||||
|
validate({ params }) {
|
||||||
|
return /([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/.test(params.id);
|
||||||
|
},
|
||||||
|
async asyncData({ $axios, params }) {
|
||||||
|
const film = await $axios.$get(`/api/films/${params.id}`);
|
||||||
|
return { film };
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
film: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style></style>
|
||||||
Reference in New Issue
Block a user