logout and info
This commit is contained in:
1 parent
4041d9827d
commit
7ea2c37116
9 files changed
+49
-34
No files matched your search
+7
-3
@@ -167,11 +167,8 @@ export default function createApi(log: Log, pg: Pg, discogs, offers, events) {
|
||||
ctx.assert(ctx.isAuthenticated(), 401, 'log in required');
|
||||
const { username } = ctx.request.body;
|
||||
const user = await pg.userFindId(ctx.state.user.id);
|
||||
|
||||
const wants = await discogs.wantListSync(username, user);
|
||||
|
||||
events.emit(Events.WantsAdded, wants);
|
||||
|
||||
ctx.response.body = wants;
|
||||
});
|
||||
|
||||
@@ -189,6 +186,13 @@ export default function createApi(log: Log, pg: Pg, discogs, offers, events) {
|
||||
ctx.response.body = results;
|
||||
});
|
||||
|
||||
router.post('/auth/logout', async (ctx, next) => {
|
||||
ctx.assert(ctx.isAuthenticated(), 401, 'log in required');
|
||||
ctx.logout();
|
||||
ctx.status = 200;
|
||||
ctx.body = { success: true };
|
||||
});
|
||||
|
||||
app.use(router.routes());
|
||||
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user