This commit is contained in:
2023-06-11 09:30:11 +02:00
parent da817cb96a
commit b1974ce50e
10 changed files with 1181 additions and 9 deletions

View File

@@ -10,7 +10,7 @@ export interface IPost extends RowDataPacket {
export async function getPost(id:Number): Promise<IPost[]> {
// let [rows]:Array<IPost> = await conn.execute("SELECT * FROM `post`", []);
return new Promise((resolve, reject) => {
let res = getConnection().then((conn)=>{conn.query<IPost[]>(`SELECT * FROM \`post\` WHERE \`id\` = ${id}`, (err:QueryError, res) => {
let res = getConnection().then((conn)=>{conn.query<IPost[]>(`SELECT * FROM post WHERE id = ${id}`, (err:QueryError, res) => {
if (err) reject(err)
else resolve(res)
});