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) {
|
export function get(req, res) {
|
||||||
if (!req.session || !req.session.passport || !req.session.passport.user) {
|
if (!req.session || !req.session.passport || !req.session.passport.user) {
|
||||||
res.send('null');
|
return send(res, 200, 'null');
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const { id, username, displayName, photo } = req.session.passport && req.session.passport.user;
|
const { id, username, displayName, photo } = req.session.passport.user;
|
||||||
res.send({ id, username, displayName, photo });
|
send(res, 200, { id, username, displayName, photo });
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
|
import send from '@polka/send';
|
||||||
import get_sections from './_sections.js';
|
import get_sections from './_sections.js';
|
||||||
|
|
||||||
let json;
|
let json;
|
||||||
|
|
||||||
export function get(req, res) {
|
export function get(req, res) {
|
||||||
if (!json || process.env.NODE_ENV !== 'production') {
|
if (!json || process.env.NODE_ENV !== 'production') {
|
||||||
json = JSON.stringify(get_sections());
|
json = get_sections();
|
||||||
}
|
}
|
||||||
|
|
||||||
res.set({
|
send(res, 200, json);
|
||||||
'Content-Type': 'application/json'
|
}
|
||||||
});
|
|
||||||
|
|
||||||
res.end(json);
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in new issue