mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-01-13 06:32:39 +00:00
Added in a logout to the user page
This commit is contained in:
20
shared/homebrewery/account.actions.js
Normal file
20
shared/homebrewery/account.actions.js
Normal file
@@ -0,0 +1,20 @@
|
||||
const Store = require('./account.store.js');
|
||||
|
||||
const Actions = {
|
||||
init : (initState) => {
|
||||
Store.init(initState);
|
||||
},
|
||||
login : ()=>{
|
||||
console.log('login');
|
||||
//redirect to the login path and add the redirect
|
||||
|
||||
},
|
||||
logout : ()=>{
|
||||
document.cookie = 'nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;domain=.naturalcrit.com';
|
||||
//Remove local dev cookies too
|
||||
document.cookie = 'nc_session=;expires=Thu, 01 Jan 1970 00:00:01 GMT;path=/;';
|
||||
window.location ='/';
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Actions;
|
||||
27
shared/homebrewery/account.store.js
Normal file
27
shared/homebrewery/account.store.js
Normal file
@@ -0,0 +1,27 @@
|
||||
const _ = require('lodash');
|
||||
const flux = require('pico-flux');
|
||||
|
||||
|
||||
let State = {
|
||||
loginPath : '',
|
||||
user : undefined,
|
||||
};
|
||||
|
||||
const Store = {}; //Maybe Flux it later?
|
||||
|
||||
|
||||
Store.init = (state)=>{
|
||||
State = _.merge({}, State, state);
|
||||
};
|
||||
Store.getLoginPath = ()=>{
|
||||
let path = State.loginPath;
|
||||
if(typeof window !== 'undefined'){
|
||||
console.log('yo here');
|
||||
}
|
||||
return path;
|
||||
};
|
||||
Store.getUser = ()=>{
|
||||
return State.user;
|
||||
};
|
||||
|
||||
module.exports = Store;
|
||||
Reference in New Issue
Block a user