Fix api path
This commit is contained in:
parent
5eafcfdf4d
commit
4cd9bd52da
@ -2,71 +2,73 @@
|
|||||||
* This file acts as an abstraction layer to the server.
|
* This file acts as an abstraction layer to the server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
const apiPath = "/schafkopf"
|
||||||
|
|
||||||
async function performRegisterPlayerRequest(name, password){
|
async function performRegisterPlayerRequest(name, password){
|
||||||
return fetch("/player/register/" + name, { method: 'POST', body: password })
|
return fetch(apiPath + "/player/register/" + name, { method: 'POST', body: password })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performDeletePlayerRequest(name, password){
|
async function performDeletePlayerRequest(name, password){
|
||||||
return fetch("/player/delete/" + name, { method: 'POST', body: password })
|
return fetch(apiPath + "/player/delete/" + name, { method: 'POST', body: password })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(function(value) {})
|
.then(function(value) {})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performLoginPlayerRequest(name, password) {
|
async function performLoginPlayerRequest(name, password) {
|
||||||
return fetch("/player/login/" + name, { method: 'POST', body: password })
|
return fetch(apiPath + "/player/login/" + name, { method: 'POST', body: password })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performLogoutRequest(token) {
|
async function performLogoutRequest(token) {
|
||||||
return fetch("/player/logout", { method: 'POST', body: token })
|
return fetch(apiPath + "/player/logout", { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(function(value) {})
|
.then(function(value) {})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function resumeSessionRequest(token) {
|
async function resumeSessionRequest(token) {
|
||||||
return fetch("/player/resume", { method: 'POST', body: token })
|
return fetch(apiPath + "/player/resume", { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performGetCurrentTableRequest(token) {
|
async function performGetCurrentTableRequest(token) {
|
||||||
return fetch("player/table", { method: 'POST', body: token })
|
return fetch(apiPath + "/player/table", { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(convertJsonResponse)
|
.then(convertJsonResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performCreateTableRequest(token, name, visibility) {
|
async function performCreateTableRequest(token, name, visibility) {
|
||||||
const vis = visibility ? "public" : "private";
|
const vis = visibility ? "public" : "private";
|
||||||
return fetch("/table/create/" + vis + "/" + name, { method: 'POST', body: token })
|
return fetch(apiPath + "/table/create/" + vis + "/" + name, { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(convertJsonResponse)
|
.then(convertJsonResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performJoinTableRequest(tableId, token) {
|
async function performJoinTableRequest(tableId, token) {
|
||||||
return fetch("/table/join/" + tableId, { method: 'POST', body: token })
|
return fetch(apiPath + "/table/join/" + tableId, { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(convertJsonResponse)
|
.then(convertJsonResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performGetPublicTablesRequest(token) {
|
async function performGetPublicTablesRequest(token) {
|
||||||
return fetch("/tables/public", { method: 'POST', body: token })
|
return fetch(apiPath + "/tables/public", { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(convertJsonResponse)
|
.then(convertJsonResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performLeaveTableRequest(token) {
|
async function performLeaveTableRequest(token) {
|
||||||
return fetch("/table/leave", { method: 'POST', body: token })
|
return fetch(apiPath + "/table/leave", { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(function(value) {})
|
.then(function(value) {})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performPlayerActionRequest(token, action) {
|
async function performPlayerActionRequest(token, action) {
|
||||||
return fetch("/player/action/" + action, { method: 'POST', body: token })
|
return fetch(apiPath + "/player/action/" + action, { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function performPlayCardRequest(token, card) {
|
async function performPlayCardRequest(token, card) {
|
||||||
return fetch("/player/card/" + card, { method: 'POST', body: token })
|
return fetch(apiPath + "/player/card/" + card, { method: 'POST', body: token })
|
||||||
.then(convertServerResponse)
|
.then(convertServerResponse)
|
||||||
.then(function(value) {})
|
.then(function(value) {})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user