Work on signup. Removed polka, using express since passport was being weird

This commit is contained in:
Robert Hall
2018-09-22 16:31:32 -06:00
parent d97a4693e1
commit 297a951fcb
11 changed files with 680 additions and 71 deletions

View File

@@ -1,7 +1,27 @@
import { init } from 'sapper/runtime.js';
import { manifest } from './manifest/client.js';
import { Store } from 'svelte/store.js'
init({
target: document.querySelector('#sapper'),
manifest
});
manifest,
store: data => {
const user = data.user;
const store = new Store(data);
if (!user) {
// SEE: https://stackoverflow.com/questions/10593013/delete-cookie-by-name
document.cookie = 'ds=;expires=Sun, 09 Jan 1974 00:00:01 GMT;';
}
store.set({
logout: () => {
return fetch('auth/logout', { method: 'POST' }).then(() => {
// SEE: https://stackoverflow.com/questions/10593013/delete-cookie-by-name
document.cookie = 'ds=;expires=Sun, 09 Jan 1974 00:00:01 GMT;';
store.set({ user: null });
window.location = '/'
})
},
})
return store
}
});