mirror of
https://github.com/Akif9748/akf-forum.git
synced 2024-11-26 13:20:41 +03:00
14 lines
No EOL
454 B
JavaScript
14 lines
No EOL
454 B
JavaScript
const { User, Thread, Message } = require("../../classes/index");
|
|
|
|
|
|
module.exports = (req, res) => {
|
|
if (!req.session.loggedin) return res.redirect('/login');
|
|
const user = new User().getId(req.session.userid);
|
|
const info = req.body;
|
|
const thread = new Thread(info.title, user).takeId().write();
|
|
thread.push(new Message(info.content, user, thread).takeId().write().id)
|
|
thread.write();
|
|
|
|
res.redirect('/threads/' + thread.id);
|
|
|
|
} |