mirror of https://github.com/sveltejs/svelte
parent
092d0be525
commit
999b1f4cdb
@ -1,9 +1,10 @@
|
||||
import send from '@polka/send';
|
||||
|
||||
export function get(req, res) {
|
||||
if (!req.session || !req.session.passport || !req.session.passport.user) {
|
||||
res.send('null');
|
||||
return;
|
||||
return send(res, 200, 'null');
|
||||
}
|
||||
|
||||
const { id, username, displayName, photo } = req.session.passport && req.session.passport.user;
|
||||
res.send({ id, username, displayName, photo });
|
||||
}
|
||||
const { id, username, displayName, photo } = req.session.passport.user;
|
||||
send(res, 200, { id, username, displayName, photo });
|
||||
}
|
||||
|
@ -1,15 +1,12 @@
|
||||
import send from '@polka/send';
|
||||
import get_sections from './_sections.js';
|
||||
|
||||
let json;
|
||||
|
||||
export function get(req, res) {
|
||||
if (!json || process.env.NODE_ENV !== 'production') {
|
||||
json = JSON.stringify(get_sections());
|
||||
json = get_sections();
|
||||
}
|
||||
|
||||
res.set({
|
||||
'Content-Type': 'application/json'
|
||||
});
|
||||
|
||||
res.end(json);
|
||||
}
|
||||
send(res, 200, json);
|
||||
}
|
||||
|
Loading…
Reference in new issue