Commit 05fb31d4 authored by satan's avatar satan
Browse files

added config

parent 322f4754
......@@ -10,7 +10,7 @@ import { terser } from "rollup-plugin-terser";
const production = process.env.NODE_ENV === "production";
export default {
input: ["src/main.ts"],
input: ["src/main.ts", "src/config.ts"],
output: {
format: "esm",
dir: "build",
......
......@@ -45,6 +45,7 @@
import { reactive, ref, unref, computed, onMounted, watch } from "vue";
import { Cell, getCell, setCell, Grid } from "./gameLogic";
import VGrid from "./components/Grid.vue";
import * as config from "./config";
const required = {
1: 0,
......@@ -83,7 +84,7 @@ export default {
});
setInterval(async () => {
const resp = await fetch("/api/gamephase");
const resp = await fetch(config.BASE_URL + "/api/gamephase");
const { phase: p } = await resp.json();
if (phase.value === "ready") {
return;
......@@ -101,7 +102,7 @@ export default {
F: Cell.WATER
};
fetch("/api/grid/my")
fetch(config.BASE_URL + "/api/grid/my")
.then(r => r.json())
.then(json => {
for (const { x, y, state } of json) {
......@@ -109,7 +110,7 @@ export default {
}
});
fetch("/api/grid/other")
fetch(config.BASE_URL + "/api/grid/other")
.then(r => r.json())
.then(json => {
for (const { x, y, state } of json) {
......@@ -125,7 +126,7 @@ export default {
myGrid.reset();
break;
case "ready":
fetch("/api/ready", {
fetch(config.BASE_URL + "/api/ready", {
method: "POST",
headers: {
"Content-Type": "application/json"
......
export const BASE_URL = "http://localhost:5000";
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment