[bug] fix "delete profile" always removing current language, not the selected one

This commit is contained in:
Andrea Vos 2021-04-21 21:17:48 +02:00
parent 823e4825a2
commit 50ff42f564
2 changed files with 3 additions and 3 deletions

View File

@ -40,7 +40,7 @@
await this.$confirm(this.$t('profile.deleteConfirm'), 'danger');
this.deleting = true;
const response = await this.$axios.$post(`/profile/delete`);
const response = await this.$axios.$post(`/profile/delete/${locale}`);
this.deleting = false;
this.$emit('update', response);
},

View File

@ -80,8 +80,8 @@ router.post('/profile/save', async (req, res) => {
return res.json(await fetchProfiles(req.db, req.user.username, true));
});
router.post('/profile/delete', async (req, res) => {
await req.db.get(SQL`DELETE FROM profiles WHERE userId = ${req.user.id} AND locale = ${req.config.locale}`);
router.post('/profile/delete/:locale', async (req, res) => {
await req.db.get(SQL`DELETE FROM profiles WHERE userId = ${req.user.id} AND locale = ${req.params.locale}`);
return res.json(await fetchProfiles(req.db, req.user.username, true));
});