Benjamin Kornblum 8 сар өмнө
parent
commit
473047df68

+ 29 - 0
package-lock.json

@@ -10,6 +10,8 @@
       "dependencies": {
         "@chenfengyuan/vue-countdown": "^2.1.3",
         "axios": "^1.8.3",
+        "dotenv": "^16.4.7",
+        "dotenv-expand": "^12.0.1",
         "magic-string": "^0.30.17",
         "pinia": "^3.0.1",
         "vue": "^3.5.13",
@@ -2656,6 +2658,33 @@
         "node": ">=0.4.0"
       }
     },
+    "node_modules/dotenv": {
+      "version": "16.4.7",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.7.tgz",
+      "integrity": "sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==",
+      "license": "BSD-2-Clause",
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://dotenvx.com"
+      }
+    },
+    "node_modules/dotenv-expand": {
+      "version": "12.0.1",
+      "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-12.0.1.tgz",
+      "integrity": "sha512-LaKRbou8gt0RNID/9RoI+J2rvXsBRPMV7p+ElHlPhcSARbCPDYcYG2s1TIzAfWv4YSgyY5taidWzzs31lNV3yQ==",
+      "license": "BSD-2-Clause",
+      "dependencies": {
+        "dotenv": "^16.4.5"
+      },
+      "engines": {
+        "node": ">=12"
+      },
+      "funding": {
+        "url": "https://dotenvx.com"
+      }
+    },
     "node_modules/dunder-proto": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",

+ 2 - 0
package.json

@@ -14,6 +14,8 @@
   "dependencies": {
     "@chenfengyuan/vue-countdown": "^2.1.3",
     "axios": "^1.8.3",
+    "dotenv": "^16.4.7",
+    "dotenv-expand": "^12.0.1",
     "magic-string": "^0.30.17",
     "pinia": "^3.0.1",
     "vue": "^3.5.13",

+ 0 - 1
src/main.ts

@@ -10,7 +10,6 @@ import VueCountdown from '@chenfengyuan/vue-countdown';
 import { useFooterLinksStore } from '@/stores/footer-content-pages'
 import { useTimelineStore } from '@/stores/timeline'
 
-
 const pinia = createPinia()
 const app = createApp(App)
 

+ 1 - 1
src/router/index.ts

@@ -13,7 +13,7 @@ export async function loadDynamicPages(newLocale:string){
   locale = newLocale
   const response = await axios.get('https://strapi.kornblum.one/api/pages?locale='+locale, {
     headers: {
-      Authorization: "Bearer c1f8dac9ec1b803aa0902dced56958c91115acbbc216832757f95457d25bde1682863bb6144d574297560f3139f0e8610d05509a4d37ec19b96d0366f4b3ccdd246c97cdff0d877eb12ec3272b58d3203fd050267c5d089b68b9e8198534d74ded49564a6a5bd64e3825b617b0f0a6fe07fdada4ae941f15b6b144abdc89d804",
+      Authorization: "Bearer " + import.meta.env.VITE_STRAPI_TOKEN,
     },
   })
   pages = response.data.data

+ 1 - 3
src/stores/footer-content-pages.ts

@@ -2,10 +2,8 @@ import { defineStore } from 'pinia'
 import axios from 'axios'
 
 
-
 export const useFooterLinksStore = defineStore('footerLinks',{
   state: () => ({
-                token: "c1f8dac9ec1b803aa0902dced56958c91115acbbc216832757f95457d25bde1682863bb6144d574297560f3139f0e8610d05509a4d37ec19b96d0366f4b3ccdd246c97cdff0d877eb12ec3272b58d3203fd050267c5d089b68b9e8198534d74ded49564a6a5bd64e3825b617b0f0a6fe07fdada4ae941f15b6b144abdc89d804",
                 locale:  (localStorage.getItem('lang') || 'de'),
                 links: []
               }),
@@ -31,7 +29,7 @@ export const useFooterLinksStore = defineStore('footerLinks',{
       async fetchLinks(){
             const response = await axios.get('https://strapi.kornblum.one/api/footer-content-pages?&populate[localizations][fields][0]=Label&populate[page][fields][1]=path&locale='+this.locale, {
             headers: {
-                Authorization: "Bearer "+this.token,
+                Authorization: "Bearer " + import.meta.env.VITE_STRAPI_TOKEN,
             },
             })
             this.links = response.data.data

+ 1 - 2
src/stores/timeline.ts

@@ -4,7 +4,6 @@ import axios from 'axios'
 
 export const useTimelineStore = defineStore('timelines',{
   state: () => ({
-    token : "c1f8dac9ec1b803aa0902dced56958c91115acbbc216832757f95457d25bde1682863bb6144d574297560f3139f0e8610d05509a4d37ec19b96d0366f4b3ccdd246c97cdff0d877eb12ec3272b58d3203fd050267c5d089b68b9e8198534d74ded49564a6a5bd64e3825b617b0f0a6fe07fdada4ae941f15b6b144abdc89d804",
     timelines: [] as Array<any>,
     locale: (localStorage.getItem('lang') || 'de')
   }),
@@ -25,7 +24,7 @@ export const useTimelineStore = defineStore('timelines',{
     async fetchTimelines(){
       const response = await axios.get('https://strapi.kornblum.one/api/timelines?locale='+this.locale, {
       headers: {
-          Authorization: "Bearer "+this.token,
+          Authorization: "Bearer "+ import.meta.env.VITE_STRAPI_TOKEN,
       },
       })
       this.timelines = response.data.data