diff --git a/src/main/kotlin/com/ray650128/pcredive/plugins/HTTP.kt b/src/main/kotlin/com/ray650128/pcredive/plugins/HTTP.kt index 4ba1d93..4a6747e 100644 --- a/src/main/kotlin/com/ray650128/pcredive/plugins/HTTP.kt +++ b/src/main/kotlin/com/ray650128/pcredive/plugins/HTTP.kt @@ -4,7 +4,9 @@ import io.ktor.http.* import io.ktor.server.plugins.cors.routing.* import io.ktor.server.application.* import io.ktor.server.http.content.* +import io.ktor.server.response.* import io.ktor.server.routing.* +import io.ktor.util.* import java.io.File fun Application.configureHTTP() { @@ -21,7 +23,4 @@ fun Application.configureHTTP() { allowCredentials = true allowNonSimpleContentTypes = true } - routing { - staticFiles("/", File("web")) - } } diff --git a/web/member/js/edit.js b/web/member/js/edit.js index 48f2c75..2a5c3c1 100644 --- a/web/member/js/edit.js +++ b/web/member/js/edit.js @@ -12,7 +12,7 @@ window.onload = function () { paramValue = getParameterByName('id'); console.log(paramValue); - axios.get("./api/member/" + paramValue) + axios.get("../api/member/" + paramValue) .then(function (response) { // 在這裡處理回傳的資料 var options = response.data; @@ -69,7 +69,7 @@ function updateMember(memberId, nickName, playerName, gameUid, discordId) { } } // 发送登录请求 - axios.put("./api/member/" + memberId, { + axios.put("../api/member/" + memberId, { playerName: playerName, nickName: nickName, discordID: discordId, @@ -77,7 +77,7 @@ function updateMember(memberId, nickName, playerName, gameUid, discordId) { leave: isLeave }) .then(function (response) { - window.location.href = "./index.html"; + window.location.href = "../index.html"; }) .catch(function (error) { //const message = error.response.data.message; @@ -87,7 +87,7 @@ function updateMember(memberId, nickName, playerName, gameUid, discordId) { } function deleteMember(memberId) { - axios.delete("./api/member/" + memberId) + axios.delete("../api/member/" + memberId) .then(function (response) { window.location.href = "./index.html"; }) diff --git a/web/member/js/index.js b/web/member/js/index.js index e546c57..ad79552 100644 --- a/web/member/js/index.js +++ b/web/member/js/index.js @@ -33,7 +33,7 @@ row_1.appendChild(heading_3); row_1.appendChild(heading_5); thead.appendChild(row_1); // 取得刀表 -axios.get("./api/member", { +axios.get("../api/member", { headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' diff --git a/web/member/js/new.js b/web/member/js/new.js index 57042a1..1616685 100644 --- a/web/member/js/new.js +++ b/web/member/js/new.js @@ -14,14 +14,14 @@ document function newMember(nickName, playerName, gameUid, discordId) { // 发送登录请求 - axios.post("./api/member", { + axios.post("../api/member", { playerName: playerName, nickName: nickName, discordID: discordId, uid: gameUid }) .then(function (response) { - window.location.href = "./index.html"; + window.location.href = "../index.html"; }) .catch(function (error) { const message = error.response.data.message;