diff --git a/src/TableManager.vue b/src/TableManager.vue index 5db2ce2..65a3d2c 100644 --- a/src/TableManager.vue +++ b/src/TableManager.vue @@ -21,27 +21,27 @@ onMounted(() => { }, ] - axios.get('http://localhost/api/tables').then((resp) => (allTables.value = resp.data)) - axios.get('http://localhost/api/active_tables').then((resp) => (activeTables.value = resp.data)) + axios.get('http://localhost/api/tables/all').then((resp) => (allTables.value = resp.data)) + axios.get('http://localhost/api/tables/active').then((resp) => (activeTables.value = resp.data)) }) function startTable(tableId: number) { - const activate = axios.get(`http://localhost/api/tables/${tableId}:start`) - activate - .then((resp) => axios.get('http://localhost/api/tables')) + const start = axios.post(`http://localhost/api/tables/${tableId}:start`) + start + .then((resp) => axios.get('http://localhost/api/tables/all')) .then((resp) => (allTables.value = resp.data)) - activate - .then((resp) => axios.get('http://localhost/api/active_tables')) + start + .then((resp) => axios.get('http://localhost/api/tables/active')) .then((resp) => (activeTables.value = resp.data)) } function stopTable(tableId: number) { - const activate = axios.get(`http://localhost/api/tables/${tableId}:stop`) - activate - .then((resp) => axios.get('http://localhost/api/tables')) + const stop = axios.post(`http://localhost/api/tables/${tableId}:stop`) + stop + .then((resp) => axios.get('http://localhost/api/tables/all')) .then((resp) => (allTables.value = resp.data)) - activate - .then((resp) => axios.get('http://localhost/api/active_tables')) + stop + .then((resp) => axios.get('http://localhost/api/tables/active')) .then((resp) => (activeTables.value = resp.data)) } @@ -60,7 +60,7 @@ function buildButtonModel(id: number) { function createTable() { axios.post("http://localhost/api/tables", - {table_name: "table name", table_link: "table link"}) + { table_name: "table name", table_link: "table link" }) } @@ -107,14 +107,8 @@ function createTable() { @@ -136,7 +130,18 @@ function createTable() { - + + + +