From 70819af7841d209c859dcb1bb2eabed3d3f37433 Mon Sep 17 00:00:00 2001 From: andrzej Date: Sun, 26 May 2024 16:39:38 +0200 Subject: [PATCH] use env variables instead of json --- .gitignore | 2 +- package.json | 2 +- src/objects/tmdb.tsx | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a0bce6e..e6715c3 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,4 @@ dist-ssr *.sln *.sw? src/conf.js -src/auth.json +.env diff --git a/package.json b/package.json index c54994f..493888f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "vite", - "build": "tsc && touch src/auth.json && vite build --base=/movie-explorer/", + "build": "tsc && vite build --base=/movie-explorer/", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "preview": "vite preview" }, diff --git a/src/objects/tmdb.tsx b/src/objects/tmdb.tsx index ffee17c..2f7cab0 100644 --- a/src/objects/tmdb.tsx +++ b/src/objects/tmdb.tsx @@ -1,12 +1,11 @@ import axios from 'axios' -import * as auth from '../auth.json'; import { Movie } from './movie-wall'; import { Config } from '../App'; const tmdb = axios.create({ baseURL: `https://api.themoviedb.org/3/movie`, headers: { - Authorization: 'Bearer ' + auth.token, + Authorization: 'Bearer ' + import.meta.env.VITE_TOKEN, 'Content-Type': 'application/json', } })