Fixed heart icon in other user's stashes. Syncing stashes to session on creation and removal.

This commit is contained in:
2024-04-02 02:50:24 +02:00
parent eb423b4886
commit 5f2b696b23
4 changed files with 61 additions and 19 deletions

View File

@@ -10,20 +10,27 @@ import {
updateStash,
} from '../stashes.js';
import { updateSessionUser } from './auth.js';
export async function createStashApi(req, res) {
const stash = await createStash(req.body, req.session.user);
await updateSessionUser(req);
res.send(stash);
}
export async function updateStashApi(req, res) {
const stash = await updateStash(Number(req.params.stashId), req.body, req.session.user);
await updateSessionUser(req);
res.send(stash);
}
export async function removeStashApi(req, res) {
await removeStash(Number(req.params.stashId), req.session.user);
await updateSessionUser(req);
res.status(204).send();
}