mirror of
https://github.com/kevin-DL/sapper-template.git
synced 2026-01-18 12:45:08 +00:00
Work on signup. Removed polka, using express since passport was being weird
This commit is contained in:
@@ -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
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user