diff --git a/package.json b/package.json
index 29b2360..3d495fd 100644
--- a/package.json
+++ b/package.json
@@ -7,13 +7,13 @@
"preview": "nuxt preview"
},
"devDependencies": {
- "@iconify/json": "^2.1.88",
+ "@iconify/json": "^2.1.91",
"@nuxtjs/svg": "^0.4.0",
"@nuxtjs/tailwindcss": "^5.3.1",
"daisyui": "^2.22.0",
"nuxt": "3.0.0-rc.6",
"unplugin-icons": "^0.14.8",
- "unplugin-vue-components": "^0.22.3"
+ "unplugin-vue-components": "^0.22.4"
},
"dependencies": {
"better-sqlite3": "^7.6.2",
diff --git a/pages/c/[cosetta].vue b/pages/c/[cosetta].vue
index 9dbf76a..e1b8354 100644
--- a/pages/c/[cosetta].vue
+++ b/pages/c/[cosetta].vue
@@ -1,10 +1,14 @@
diff --git a/server/api/comment.post.js b/server/api/comment.post.js
index 359a131..cc76035 100644
--- a/server/api/comment.post.js
+++ b/server/api/comment.post.js
@@ -4,8 +4,8 @@ import { useBody } from 'h3'
export default defineEventHandler(async (event) => {
try {
const body = await useBody(event)
- addComment(body)
- return { success: true }
+ const comment = addComment(body)
+ return { success: true, comment }
} catch (e) {
return { success: false, reason: e.message }
}
diff --git a/server/api/cosette.post.js b/server/api/cosette.post.js
index 9f4d6f3..de91251 100644
--- a/server/api/cosette.post.js
+++ b/server/api/cosette.post.js
@@ -9,8 +9,8 @@ export default defineEventHandler(async (event) => {
const body = await useBody(event)
body.imgs = [event.req.file?.filename]
add(body)
- sendRedirect(event, '/')
+ return sendRedirect(event, 'http://localhost:3000')
} catch (e) {
return { success: false, reason: e.message }
}
-})
\ No newline at end of file
+})
diff --git a/server/controller.js b/server/controller.js
index fd2b8d0..8b9cd74 100644
--- a/server/controller.js
+++ b/server/controller.js
@@ -7,6 +7,7 @@ function load () {
db.exec('CREATE TABLE IF NOT EXISTS cosette (uuid TEXT PRIMARY KEY, name TEXT NOT NULL, description TEXT, tags TEXT, images TEXT, updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP)')
db.exec('CREATE TABLE IF NOT EXISTS chan (uuid TEXT PRIMARY KEY, cosetta_uuid REFERENCES cosette(uuid), message TEXT, updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP)')
}
+// TODO: da gestire in qualche modo all'avvio
// load()
export function add (cosetta) {
@@ -42,10 +43,8 @@ export function getAll (limit=0, offset=0, tags=[], search='') {
export function addComment (comment) {
- console.error('sono dentro addComment', comment)
const q = db.prepare('INSERT INTO chan (uuid, cosetta_uuid, message) VALUES(:uuid, :cosetta_uuid, :message)')
comment.uuid = v4()
- console.error(comment)
q.run(comment)
return comment
}
diff --git a/yarn.lock b/yarn.lock
index 91f7cad..4b7df44 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -293,10 +293,10 @@
resolved "https://registry.yarnpkg.com/@csstools/selector-specificity/-/selector-specificity-2.0.2.tgz#1bfafe4b7ed0f3e4105837e056e0a89b108ebe36"
integrity sha512-IkpVW/ehM1hWKln4fCA3NzJU8KwD+kIOvPZA4cqxoJHtE21CCzjyp+Kxbu0i5I4tBNOlXPL9mjwnWlL0VEG4Fg==
-"@iconify/json@^2.1.88":
- version "2.1.88"
- resolved "https://registry.yarnpkg.com/@iconify/json/-/json-2.1.88.tgz#05d987dedab3dc9f95407596be5823beb925d6b4"
- integrity sha512-oPrKWtn7rZDwhAGdIMCzxpcKkXpRET3lfvVgwqiMJaCTx4jKbXJYHGw/F2PuiGkvxFi6pNNayBZ9q7+R9ZXKmg==
+"@iconify/json@^2.1.91":
+ version "2.1.91"
+ resolved "https://registry.yarnpkg.com/@iconify/json/-/json-2.1.91.tgz#d66e9a8e41ebbde74fa4278c31777dbf54393b1f"
+ integrity sha512-GjvdX5E09r0hjRp6woaR2bUPpziMboqk3Cdb1cVi4bZTQT4hdHOBJ8IxV9LNgBTfeNgbxWIf1w+IhFG1xawvrg==
dependencies:
"@iconify/types" "*"
pathe "^0.3.0"
@@ -6270,10 +6270,10 @@ unplugin-icons@^0.14.8:
local-pkg "^0.4.2"
unplugin "^0.8.0"
-unplugin-vue-components@^0.22.3:
- version "0.22.3"
- resolved "https://registry.yarnpkg.com/unplugin-vue-components/-/unplugin-vue-components-0.22.3.tgz#e799e49486476b5413d3b0983874bc8a92429ad4"
- integrity sha512-f31VCJF0K9oXCzKizJqNpmQz2XYTA0gjq+E5zM3hB8JxZ6cy5sXxO91fK2pI1TFGeM3JCe6yC9BJDymkMbXnNg==
+unplugin-vue-components@^0.22.4:
+ version "0.22.4"
+ resolved "https://registry.yarnpkg.com/unplugin-vue-components/-/unplugin-vue-components-0.22.4.tgz#774a96339368f3b8436fa7c20e059d9fee42c983"
+ integrity sha512-2rRZcM9OnJGXnYxQNfaceEYuPeVACcWySIjy8WBwIiN3onr980TmA3XE5pRJFt8zoQrUA+c46oyIq96noLqrEQ==
dependencies:
"@antfu/utils" "^0.5.2"
"@rollup/pluginutils" "^4.2.1"