backend port is now readed from environment

This commit is contained in:
zurdi zurdo
2023-03-15 12:04:16 +01:00
parent 757f890e41
commit 820f273ed4
4 changed files with 8 additions and 5 deletions

1
frontend/.env Normal file
View File

@@ -0,0 +1 @@
VITE_BACK_PORT="5000"

View File

@@ -12,7 +12,7 @@ useTheme().global.name.value = localStorage.getItem('theme') || 'dark'
async function getRoms(platformSlug){
await router.push('/')
await router.push(import.meta.env.BASE_URL)
viewComponent.value.getRoms(platformSlug)
}
@@ -21,7 +21,7 @@ async function gettingRoms(flag){
}
async function getRomDetails(rom) {
await router.push('/details')
await router.push(import.meta.env.BASE_URL+'details')
viewComponent.value.getRomDetails(rom)
}
</script>

View File

@@ -7,6 +7,7 @@ import { useTheme } from "vuetify";
const emit = defineEmits(['currentPlatformSlug'])
defineExpose({ gettingRoms })
const platforms = ref([])
const backPort = import.meta.env.VITE_BACK_PORT
const currentPlatformName = ref(localStorage.getItem('currentPlatformName') || "")
const scanOverwrite = ref(false)
const scanning = ref(false)
@@ -19,7 +20,7 @@ const darkMode = (localStorage.getItem('theme') == 'light') ? ref(false) : ref(t
async function getPlatforms() {
console.log("Getting platforms...")
await axios.get('http://'+location.hostname+':5000/platforms').then((response) => {
await axios.get('http://'+location.hostname+':'+backPort+'/platforms').then((response) => {
console.log("Platforms loaded!")
console.log(response.data.data)
platforms.value = response.data.data
@@ -36,7 +37,7 @@ function selectPlatform(platform){
async function scan() {
console.log("scanning...")
scanning.value = true
await axios.get('http://'+location.hostname+':5000/scan?overwrite='+scanOverwrite.value).then((response) => {
await axios.get('http://'+location.hostname+':'+backPort+'/scan?overwrite='+scanOverwrite.value).then((response) => {
console.log("scan completed")
console.log(response.data)
getPlatforms()

View File

@@ -7,6 +7,7 @@ import { saveAs } from 'file-saver';
const emit = defineEmits(['currentRom', 'gettingRoms'])
defineExpose({ getRoms })
const roms = ref([])
const backPort = import.meta.env.VITE_BACK_PORT
const noRoms = ref(false)
var currentPlatformSlug = localStorage.getItem('currentPlatformSlug') || ""
@@ -15,7 +16,7 @@ async function getRoms(platform) {
currentPlatformSlug = platform
console.log("Getting roms...")
emit('gettingRoms', true)
await axios.get('http://'+location.hostname+':5000/platforms/'+platform+'/roms').then((response) => {
await axios.get('http://'+location.hostname+':'+backPort+'/platforms/'+platform+'/roms').then((response) => {
console.log("Roms loaded!")
console.log(response.data.data)
roms.value = response.data.data