mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 00:21:20 -05:00
Remove token storage
We're not using it yet, and it won't be coming from the cookie when we do.
This commit is contained in:
parent
a4a2688084
commit
a497fed338
3 changed files with 0 additions and 53 deletions
|
@ -4,11 +4,9 @@ var scheduleReducer = require('./conference-schedule.js').scheduleReducer;
|
|||
var detailsReducer = require('./conference-details.js').detailsReducer;
|
||||
var permissionsReducer = require('./permissions.js').permissionsReducer;
|
||||
var sessionReducer = require('./session.js').sessionReducer;
|
||||
var tokenReducer = require('./token.js').tokenReducer;
|
||||
|
||||
var appReducer = combineReducers({
|
||||
session: sessionReducer,
|
||||
token: tokenReducer,
|
||||
permissions: permissionsReducer,
|
||||
conferenceSchedule: scheduleReducer,
|
||||
conferenceDetails: detailsReducer
|
||||
|
|
|
@ -3,7 +3,6 @@ var defaults = require('lodash.defaults');
|
|||
|
||||
var api = require('../lib/api');
|
||||
var permissionsActions = require('./permissions.js');
|
||||
var tokenActions = require('./token.js');
|
||||
|
||||
var Types = keyMirror({
|
||||
SET_SESSION: null,
|
||||
|
@ -86,7 +85,6 @@ module.exports.refreshSession = function () {
|
|||
window.location.pathname !== '/classes/student_password_reset/') {
|
||||
return window.location = '/classes/student_password_reset/';
|
||||
} else {
|
||||
dispatch(tokenActions.getToken());
|
||||
dispatch(module.exports.setSession(body));
|
||||
dispatch(module.exports.setStatus(module.exports.Status.FETCHED));
|
||||
|
||||
|
|
|
@ -1,49 +0,0 @@
|
|||
var keyMirror = require('keymirror');
|
||||
var jar = require('../lib/jar.js');
|
||||
|
||||
var Types = keyMirror({
|
||||
SET_TOKEN: null,
|
||||
SET_TOKEN_ERROR: null,
|
||||
USE_TOKEN: null
|
||||
});
|
||||
|
||||
module.exports.tokenReducer = function (state, action) {
|
||||
// Reducer for updating the api token
|
||||
if (typeof state === 'undefined') {
|
||||
state = '';
|
||||
}
|
||||
switch (action.type) {
|
||||
case Types.SET_TOKEN:
|
||||
return action.token;
|
||||
case Types.SET_TOKEN_ERROR:
|
||||
// TODO: do something with the error
|
||||
return state;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.getToken = function () {
|
||||
return function (dispatch) {
|
||||
jar.getUnsignedValue('scratchsessionsid', 'token', function (err, value) {
|
||||
if (err) return dispatch(module.exports.setTokenError(err));
|
||||
|
||||
value = value || '';
|
||||
return dispatch(module.exports.setToken(value));
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.setToken = function (token) {
|
||||
return {
|
||||
type: Types.SET_TOKEN,
|
||||
token: token
|
||||
};
|
||||
};
|
||||
|
||||
module.exports.setTokenError = function (error) {
|
||||
return {
|
||||
type: Types.SET_TOKEN_ERROR,
|
||||
error: error
|
||||
};
|
||||
};
|
Loading…
Reference in a new issue