From ef4966037635472efc6e1df81cd89f7ff937f351 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Mon, 29 Mar 2021 16:18:14 +0200 Subject: [PATCH 1/3] - Removed all useless readme --- assets/README.md | 7 ------- layouts/README.md | 7 ------- middleware/README.md | 8 -------- pages/README.md | 6 ------ plugins/README.md | 7 ------- static/README.md | 11 ----------- 6 files changed, 46 deletions(-) delete mode 100644 assets/README.md delete mode 100644 layouts/README.md delete mode 100644 middleware/README.md delete mode 100644 pages/README.md delete mode 100644 plugins/README.md delete mode 100644 static/README.md diff --git a/assets/README.md b/assets/README.md deleted file mode 100644 index 34766f9..0000000 --- a/assets/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# ASSETS - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains your un-compiled assets such as LESS, SASS, or JavaScript. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#webpacked). diff --git a/layouts/README.md b/layouts/README.md deleted file mode 100644 index cad1ad5..0000000 --- a/layouts/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# LAYOUTS - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains your Application Layouts. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/views#layouts). diff --git a/middleware/README.md b/middleware/README.md deleted file mode 100644 index 01595de..0000000 --- a/middleware/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# MIDDLEWARE - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains your application middleware. -Middleware let you define custom functions that can be run before rendering either a page or a group of pages. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing#middleware). diff --git a/pages/README.md b/pages/README.md deleted file mode 100644 index 1d5d48b..0000000 --- a/pages/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# PAGES - -This directory contains your Application Views and Routes. -The framework reads all the `*.vue` files inside this directory and creates the router of your application. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/routing). diff --git a/plugins/README.md b/plugins/README.md deleted file mode 100644 index ca1f9d8..0000000 --- a/plugins/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# PLUGINS - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains Javascript plugins that you want to run before mounting the root Vue.js application. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/plugins). diff --git a/static/README.md b/static/README.md deleted file mode 100644 index cf00435..0000000 --- a/static/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# STATIC - -**This directory is not required, you can delete it if you don't want to use it.** - -This directory contains your static files. -Each file inside this directory is mapped to `/`. -Thus you'd want to delete this README.md before deploying to production. - -Example: `/static/robots.txt` is mapped as `/robots.txt`. - -More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/assets#static). From b9fe9ca5146a733a9948f91c411bfa37184c85af Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Mon, 29 Mar 2021 16:18:37 +0200 Subject: [PATCH 2/3] + Added layout page and error handler --- layouts/error.vue | 44 ++++++++++++++++++++++++++++++++++++++++++ pages/astres/_slug.vue | 17 +++++++++------- 2 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 layouts/error.vue diff --git a/layouts/error.vue b/layouts/error.vue new file mode 100644 index 0000000..0984de6 --- /dev/null +++ b/layouts/error.vue @@ -0,0 +1,44 @@ + + + + + diff --git a/pages/astres/_slug.vue b/pages/astres/_slug.vue index d3349b0..ae1fe99 100644 --- a/pages/astres/_slug.vue +++ b/pages/astres/_slug.vue @@ -53,22 +53,25 @@ import { fetchCelestial } from '@/api/le-systeme-solaire' export default { name: 'Celestial', - data () { - return { - celestial: false + async asyncData ({ params, error }) { + const slug = params.slug + try { + const celestial = await fetchCelestial(slug) + return { celestial } + } catch (err) { + error(err) } }, mounted () { - // Fetches from API... fetchCelestial(this.$route.params.slug) .then((res) => { this.celestial = res return this.celestial }) - // .catch((err) => { - // console.error(err) - // }) + .catch(() => { + console.log('test') + }) } } From b91bc080dd0019455c33b4633c831edf79a690f3 Mon Sep 17 00:00:00 2001 From: Alexis <35.alexis.pele@gmail.com> Date: Mon, 29 Mar 2021 16:44:24 +0200 Subject: [PATCH 3/3] / Cleanup of error layout, readme --- README.md | 1 + layouts/error.vue | 4 ++-- pages/astres/_slug.vue | 11 ----------- test/Logo.spec.js | 9 --------- 4 files changed, 3 insertions(+), 22 deletions(-) delete mode 100644 test/Logo.spec.js diff --git a/README.md b/README.md index fcb7273..91de248 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # full-skies Ce projet a pour but d'exploiter [l'API Le Système Solaire](https://api.le-systeme-solaire.net/) et de proposer une interface simple pour selectionner des favoris. +Il a été conçu lors d'un module d'apprentissage de Nuxt/Vue à MyDigitalSchool. - [Dependencies](#dependencies) - [How to install](#how-to-install) ## Dependencies diff --git a/layouts/error.vue b/layouts/error.vue index 0984de6..673f5ea 100644 --- a/layouts/error.vue +++ b/layouts/error.vue @@ -21,8 +21,8 @@ export default { layout: 'error', props: { error: { - type: String, - default: '' + type: Object, + default: () => { return {} } } } } diff --git a/pages/astres/_slug.vue b/pages/astres/_slug.vue index ae1fe99..61f5b62 100644 --- a/pages/astres/_slug.vue +++ b/pages/astres/_slug.vue @@ -61,17 +61,6 @@ export default { } catch (err) { error(err) } - }, - - mounted () { - fetchCelestial(this.$route.params.slug) - .then((res) => { - this.celestial = res - return this.celestial - }) - .catch(() => { - console.log('test') - }) } } diff --git a/test/Logo.spec.js b/test/Logo.spec.js deleted file mode 100644 index c5fbeeb..0000000 --- a/test/Logo.spec.js +++ /dev/null @@ -1,9 +0,0 @@ -import { mount } from '@vue/test-utils' -import Logo from '@/components/Logo.vue' - -describe('Logo', () => { - test('is a Vue instance', () => { - const wrapper = mount(Logo) - expect(wrapper.vm).toBeTruthy() - }) -})