mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-20 00:09:53 +00:00
use api prefix
This commit is contained in:
@@ -589,7 +589,7 @@ export class HostLobbyModal extends LitElement {
|
||||
private async putGameConfig() {
|
||||
const config = await getServerConfigFromClient();
|
||||
const response = await fetch(
|
||||
`${window.location.origin}/${config.workerPath(this.lobbyId)}/game/${this.lobbyId}`,
|
||||
`${window.location.origin}/api/${config.workerPath(this.lobbyId)}/game/${this.lobbyId}`,
|
||||
{
|
||||
method: "PUT",
|
||||
headers: {
|
||||
@@ -615,7 +615,7 @@ export class HostLobbyModal extends LitElement {
|
||||
this.close();
|
||||
const config = await getServerConfigFromClient();
|
||||
const response = await fetch(
|
||||
`${window.location.origin}/${config.workerPath(this.lobbyId)}/start_game/${this.lobbyId}`,
|
||||
`${window.location.origin}/${config.workerPath(this.lobbyId)}/api/start_game/${this.lobbyId}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -642,7 +642,7 @@ export class HostLobbyModal extends LitElement {
|
||||
|
||||
private async pollPlayers() {
|
||||
const config = await getServerConfigFromClient();
|
||||
fetch(`/${config.workerPath(this.lobbyId)}/game/${this.lobbyId}`, {
|
||||
fetch(`/${config.workerPath(this.lobbyId)}/api/game/${this.lobbyId}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
@@ -661,7 +661,7 @@ async function createLobby(): Promise<GameInfo> {
|
||||
try {
|
||||
const id = generateID();
|
||||
const response = await fetch(
|
||||
`/${config.workerPath(id)}/create_game/${id}`,
|
||||
`/${config.workerPath(id)}/api/create_game/${id}`,
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
|
||||
@@ -361,7 +361,7 @@ export class JoinPrivateLobbyModal extends LitElement {
|
||||
this.message = "Checking lobby..."; // Set initial message
|
||||
|
||||
const config = await getServerConfigFromClient();
|
||||
const url = `/${config.workerPath(lobbyId)}/game/${lobbyId}/exists`;
|
||||
const url = `/${config.workerPath(lobbyId)}/api/game/${lobbyId}/exists`;
|
||||
fetch(url, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
@@ -402,7 +402,7 @@ export class JoinPrivateLobbyModal extends LitElement {
|
||||
const config = await getServerConfigFromClient();
|
||||
|
||||
fetch(
|
||||
`/${config.workerPath(this.lobbyIdInput.value)}/game/${this.lobbyIdInput.value}`,
|
||||
`/${config.workerPath(this.lobbyIdInput.value)}/api/game/${this.lobbyIdInput.value}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
||||
@@ -126,6 +126,6 @@ export class LocalServer {
|
||||
type: "application/json",
|
||||
});
|
||||
const workerPath = this.serverConfig.workerPath(this.lobbyConfig.gameID);
|
||||
navigator.sendBeacon(`/${workerPath}/archive_singleplayer_game`, blob);
|
||||
navigator.sendBeacon(`/${workerPath}/api/archive_singleplayer_game`, blob);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ export class PublicLobby extends LitElement {
|
||||
|
||||
async fetchLobbies(): Promise<GameInfo[]> {
|
||||
try {
|
||||
const response = await fetch(`/public_lobbies`);
|
||||
const response = await fetch(`/api/public_lobbies`);
|
||||
if (!response.ok)
|
||||
throw new Error(`HTTP error! status: ${response.status}`);
|
||||
const data = await response.json();
|
||||
|
||||
Reference in New Issue
Block a user