Work on login

This commit is contained in:
Robert Hall
2018-09-24 19:36:50 -06:00
parent eae1e42dd4
commit f89fbadcdc
4 changed files with 108 additions and 49 deletions

View File

@@ -3,10 +3,10 @@ import express from 'express';
import bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';
import { authSetup } from './auth/setup';
import { authValidate } from './auth/validate';
import sapper from 'sapper';
import compression from 'compression';
import { Store } from 'svelte/store.js';
// import { validate } from '../routes/_services/auth-check.js';
import { manifest } from './manifest/server.js';
const { PORT, NODE_ENV } = process.env;
@@ -25,9 +25,8 @@ authSetup(app)
app.use(sapper({
manifest,
store: req => {
// const user = validate(req);
// return new Store({ user: user.unauthorized ? null : user });
return new Store({ user: null });
const user = authValidate(req);
return new Store({ user: user.unauthorized ? null : user });
},
}))