url not hardcoded
This commit is contained in:
parent
c19fac2dc5
commit
e7a6dc5cd8
@ -1,8 +1,8 @@
|
||||
podman build --tag alipricetrack:1.0.0 -f ./Dockerfile
|
||||
|
||||
|
||||
podman pod create --name aliexpress -p 8080:8080
|
||||
podman pod create --name aliexpress -p 8086:8080
|
||||
|
||||
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" -v /home/fire/Downloads/db:/var/lib/postgresql/data --name ali-db docker.io/postgres
|
||||
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" -v /home/data/podman/aliexpress/db:/var/lib/postgresql/data:Z --name ali-db docker.io/postgres
|
||||
|
||||
podman run -d --pod=aliexpress -e POSTGRES_DB="aliexpress" -e POSTGRES_USER="postgres" -e POSTGRES_PASSWORD="postgres" --name ali-app alipricetrack:1.0.0
|
||||
|
@ -7,4 +7,10 @@
|
||||
<!-- Create a div where the graphs will take place -->
|
||||
<div id="graphs"></div>
|
||||
|
||||
<script src="http://127.0.0.1/app.js"></script>
|
||||
<!-- <script src="http://127.0.0.1/app.js"></script> -->
|
||||
<script>
|
||||
let currenturl = (window.location);
|
||||
var s = document.createElement( 'script' );
|
||||
s.setAttribute( 'src', `${currenturl}/app.js` );
|
||||
document.body.appendChild( s );
|
||||
</script>
|
||||
|
@ -11,6 +11,10 @@ const margin = {
|
||||
// get window width
|
||||
const width = window.innerWidth - margin.right - margin.left -10;
|
||||
|
||||
// url
|
||||
const currentUrl = window.location.href;
|
||||
console.log(currentUrl);
|
||||
|
||||
|
||||
// reload page when window is resized
|
||||
// (resizes every elements)
|
||||
@ -18,7 +22,7 @@ window.onresize = function(){ location.reload(); }
|
||||
|
||||
async function fetch_history() {
|
||||
try {
|
||||
const response = await fetch('http://127.0.0.1:8080/datahistory');
|
||||
const response = await fetch(`${currentUrl}/datahistory`);
|
||||
const rawData = await response.json();
|
||||
// SELECT uuid, quantity, discount_percentage, price, currency, h_timestamp
|
||||
let historyData = rawData.map(d => ({
|
||||
@ -37,7 +41,7 @@ async function fetch_history() {
|
||||
async function fetch_item() {
|
||||
try {
|
||||
// SELECT uuid, itemid, skuid, choice, attributes, image
|
||||
const response = await fetch('http://127.0.0.1:8080/dataitem');
|
||||
const response = await fetch(`${currentUrl}/dataitem`);
|
||||
const rawData = await response.json();
|
||||
const items = rawData.reduce((item, row) => {
|
||||
const uuid = row[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user