add cors to /api/shop/items

This commit is contained in:
ZareMate 2026-01-09 05:09:32 +01:00
parent 32d4047278
commit c26e9e7782

View File

@ -226,6 +226,7 @@ module.exports = function (app, wss, pool) {
app.get("/api/shop/items", async (req, res) => { app.get("/api/shop/items", async (req, res) => {
const conn = await pool.getConnection(); const conn = await pool.getConnection();
res.set("Access-Control-Allow-Origin", "*");
try { try {
const rows = await conn.query( const rows = await conn.query(
"SELECT id, name, price, quantity FROM shop_items WHERE enabled = 1", "SELECT id, name, price, quantity FROM shop_items WHERE enabled = 1",
@ -240,6 +241,7 @@ module.exports = function (app, wss, pool) {
app.get("/api/shop/items/all", async (req, res) => { app.get("/api/shop/items/all", async (req, res) => {
const conn = await pool.getConnection(); const conn = await pool.getConnection();
res.set("Access-Control-Allow-Origin", "*");
try { try {
const rows = await conn.query("SELECT * FROM shop_items"); const rows = await conn.query("SELECT * FROM shop_items");
res.json({ ok: true, items: rows }); res.json({ ok: true, items: rows });