Showing
7 changed files
with
29 additions
and
12 deletions
1 | +0.5.1: | ||
2 | +- Mise à jour de dépendances. | ||
3 | +- Personnalisation d'une règle concernant les v-slot dans le fichier eslint.config.mjs. | ||
4 | +- Configuration d'un proxy pour tmdb via nitro dans le fichier nuxt.config. | ||
5 | +- Adaptation des routes pour les requêtes vers tmdb dans le composable useTMDB, afin de déclencher le proxy et modification de l'interceptor onRequest du plugin oFetch afin de supprimer l'hydratation de la baseUrl et ne conserver que l'ajout de la config du header Authorization avec le déclencheur de resquest /tmdb. | ||
6 | + | ||
1 | 0.5.0: | 7 | 0.5.0: |
2 | - Mise en place du plugin oFetch pour personnaliser la gestion des requêtes. | 8 | - Mise en place du plugin oFetch pour personnaliser la gestion des requêtes. |
3 | - Ajout interface/response/TMDB. | 9 | - Ajout interface/response/TMDB. |
@@ -11,7 +11,7 @@ export function useTMDB() { | @@ -11,7 +11,7 @@ export function useTMDB() { | ||
11 | * @param page | 11 | * @param page |
12 | */ | 12 | */ |
13 | const fetchPopularMovies = async (page: number) => { | 13 | const fetchPopularMovies = async (page: number) => { |
14 | - const { data, status, error, execute } = await useFetch(`/movie/popular`, { | 14 | + const { data, status, error, execute } = await useFetch(`/tmdb/movie/popular`, { |
15 | params: { ...paramsBase, page }, | 15 | params: { ...paramsBase, page }, |
16 | }); | 16 | }); |
17 | if (unref(status) === "idle") await execute(); | 17 | if (unref(status) === "idle") await execute(); |
@@ -25,7 +25,7 @@ export function useTMDB() { | @@ -25,7 +25,7 @@ export function useTMDB() { | ||
25 | * @param page | 25 | * @param page |
26 | */ | 26 | */ |
27 | const searchMovies = async (query: string, page: number) => { | 27 | const searchMovies = async (query: string, page: number) => { |
28 | - const { data, status, error, execute } = await useFetch(`/search/movie`, { | 28 | + const { data, status, error, execute } = await useFetch(`/tmdb/search/movie`, { |
29 | params: { ...paramsBase, page, query: encodeURIComponent(query) }, | 29 | params: { ...paramsBase, page, query: encodeURIComponent(query) }, |
30 | }); | 30 | }); |
31 | if (unref(status) === "idle") await execute(); | 31 | if (unref(status) === "idle") await execute(); |
@@ -38,7 +38,7 @@ export function useTMDB() { | @@ -38,7 +38,7 @@ export function useTMDB() { | ||
38 | * @param id | 38 | * @param id |
39 | */ | 39 | */ |
40 | const fetchMovieDetails = async (id: number | string) => { | 40 | const fetchMovieDetails = async (id: number | string) => { |
41 | - const { data, status, error, execute } = await useFetch(`/movie/${id}`, { | 41 | + const { data, status, error, execute } = await useFetch(`/tmdb/movie/${id}`, { |
42 | params: { ...paramsBase }, | 42 | params: { ...paramsBase }, |
43 | }); | 43 | }); |
44 | if (unref(status) === "idle") await execute(); | 44 | if (unref(status) === "idle") await execute(); |
@@ -50,7 +50,7 @@ export function useTMDB() { | @@ -50,7 +50,7 @@ export function useTMDB() { | ||
50 | * Fetch movie credits | 50 | * Fetch movie credits |
51 | */ | 51 | */ |
52 | const fetchMovieCredits = async (id: number | string) => { | 52 | const fetchMovieCredits = async (id: number | string) => { |
53 | - const { data, status, error, execute } = await useFetch(`/movie/${id}/credits`, { | 53 | + const { data, status, error, execute } = await useFetch(`/tmdb/movie/${id}/credits`, { |
54 | params: { ...paramsBase }, | 54 | params: { ...paramsBase }, |
55 | }); | 55 | }); |
56 | if (unref(status) === "idle") await execute(); | 56 | if (unref(status) === "idle") await execute(); |
@@ -28,6 +28,7 @@ export default antfu({ | @@ -28,6 +28,7 @@ export default antfu({ | ||
28 | rules: { | 28 | rules: { |
29 | "antfu/if-newline": 0, | 29 | "antfu/if-newline": 0, |
30 | "antfu/curly": 0, | 30 | "antfu/curly": 0, |
31 | + "vue/valid-v-slot": 0, | ||
31 | }, | 32 | }, |
32 | 33 | ||
33 | // Enable stylistic formatting rules. | 34 | // Enable stylistic formatting rules. |
@@ -55,6 +55,16 @@ export default defineNuxtConfig({ | @@ -55,6 +55,16 @@ export default defineNuxtConfig({ | ||
55 | "@vueuse/nuxt", | 55 | "@vueuse/nuxt", |
56 | "vuetify-nuxt-module", | 56 | "vuetify-nuxt-module", |
57 | ], | 57 | ], |
58 | + | ||
59 | + nitro: { | ||
60 | + devProxy: { | ||
61 | + "/tmdb/": { | ||
62 | + target: process.env.NUXT_ENV_TMDB_URL, | ||
63 | + changeOrigin: true, | ||
64 | + }, | ||
65 | + }, | ||
66 | + }, | ||
67 | + | ||
58 | // Persisted state config. | 68 | // Persisted state config. |
59 | piniaPluginPersistedstate: { | 69 | piniaPluginPersistedstate: { |
60 | storage: "localStorage", | 70 | storage: "localStorage", |
This diff is collapsed. Click to expand it.
1 | { | 1 | { |
2 | "name": "nuxt-app", | 2 | "name": "nuxt-app", |
3 | - "version": "0.5.0", | 3 | + "version": "0.5.1", |
4 | "private": true, | 4 | "private": true, |
5 | "type": "module", | 5 | "type": "module", |
6 | "scripts": { | 6 | "scripts": { |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | "@tinymce/tinymce-vue": "^5.1.1", | 24 | "@tinymce/tinymce-vue": "^5.1.1", |
25 | "@types/vuelidate": "^0.7.22", | 25 | "@types/vuelidate": "^0.7.22", |
26 | "@unhead/vue": "^2.0.8", | 26 | "@unhead/vue": "^2.0.8", |
27 | - "@vitejs/plugin-vue": "^5.2.3", | 27 | + "@vitejs/plugin-vue": "^5.2.4", |
28 | "@vuelidate/core": "^2.0.3", | 28 | "@vuelidate/core": "^2.0.3", |
29 | "@vuelidate/validators": "^2.0.4", | 29 | "@vuelidate/validators": "^2.0.4", |
30 | "@vueuse/core": "^13.2.0", | 30 | "@vueuse/core": "^13.2.0", |
@@ -34,21 +34,21 @@ | @@ -34,21 +34,21 @@ | ||
34 | "nuxt": "^3.16.2", | 34 | "nuxt": "^3.16.2", |
35 | "pinia": "^2.3.1", | 35 | "pinia": "^2.3.1", |
36 | "pinia-plugin-persistedstate": "^4.2.0", | 36 | "pinia-plugin-persistedstate": "^4.2.0", |
37 | - "vue": "^3.5.13", | 37 | + "vue": "^3.5.14", |
38 | "vue-router": "^4.5.0", | 38 | "vue-router": "^4.5.0", |
39 | "vuetify-nuxt-module": "^0.18.6" | 39 | "vuetify-nuxt-module": "^0.18.6" |
40 | }, | 40 | }, |
41 | "devDependencies": { | 41 | "devDependencies": { |
42 | "@antfu/eslint-config": "^4.13.0", | 42 | "@antfu/eslint-config": "^4.13.0", |
43 | - "@nuxt/test-utils": "^3.17.2", | 43 | + "@nuxt/test-utils": "^3.19.0", |
44 | "@nuxtjs/tailwindcss": "^6.13.2", | 44 | "@nuxtjs/tailwindcss": "^6.13.2", |
45 | "@typescript-eslint/parser": "^8.32.1", | 45 | "@typescript-eslint/parser": "^8.32.1", |
46 | "@vue/test-utils": "^2.4.6", | 46 | "@vue/test-utils": "^2.4.6", |
47 | - "happy-dom": "^17.4.4", | 47 | + "happy-dom": "^17.4.7", |
48 | "jsdom": "^26.1.0", | 48 | "jsdom": "^26.1.0", |
49 | "playwright-core": "^1.52.0", | 49 | "playwright-core": "^1.52.0", |
50 | "typescript-eslint": "^8.32.1", | 50 | "typescript-eslint": "^8.32.1", |
51 | - "vitest": "^3.1.2", | 51 | + "vitest": "^3.1.4", |
52 | "vue-eslint-parser": "^10.1.3" | 52 | "vue-eslint-parser": "^10.1.3" |
53 | } | 53 | } |
54 | } | 54 | } |
@@ -16,11 +16,11 @@ export default defineNuxtPlugin(async (_nuxtApp) => { | @@ -16,11 +16,11 @@ export default defineNuxtPlugin(async (_nuxtApp) => { | ||
16 | * Request interceptor. | 16 | * Request interceptor. |
17 | */ | 17 | */ |
18 | onRequest({ request, options }) { | 18 | onRequest({ request, options }) { |
19 | - if (typeof request === "string" && request.includes("movie")) { | 19 | + if (typeof request === "string" && request.includes("/tmdb")) { |
20 | /** empty */ | 20 | /** empty */ |
21 | // Set the baseURL to the TMDB API URL. | 21 | // Set the baseURL to the TMDB API URL. |
22 | // Base url example : https://nom-de-domaine/something. | 22 | // Base url example : https://nom-de-domaine/something. |
23 | - options.baseURL = runtimeConfig.public.apiTMDBUrl; | 23 | + // options.baseURL = runtimeConfig.public.apiTMDBUrl; |
24 | 24 | ||
25 | // Set the request headers | 25 | // Set the request headers |
26 | // note that this relies on ofetch >= 1.4.0 - you may need to refresh your lockfile. | 26 | // note that this relies on ofetch >= 1.4.0 - you may need to refresh your lockfile. |
-
Please register or login to post a comment