From 92afd296509de82e7550f67064b032db916b1f63 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Fri, 26 Aug 2016 19:12:19 +0200 Subject: The frontend will now be an OAuth app, auto-authorized. The frontend will use an access token for API requests Adding better errors for the API controllers, posting a simple status works from the frontend now --- app/assets/javascripts/components/reducers/index.jsx | 4 +++- app/assets/javascripts/components/reducers/meta.jsx | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 app/assets/javascripts/components/reducers/meta.jsx (limited to 'app/assets/javascripts/components/reducers') diff --git a/app/assets/javascripts/components/reducers/index.jsx b/app/assets/javascripts/components/reducers/index.jsx index c7e858f38..96c026c8c 100644 --- a/app/assets/javascripts/components/reducers/index.jsx +++ b/app/assets/javascripts/components/reducers/index.jsx @@ -1,6 +1,8 @@ import { combineReducers } from 'redux-immutable'; import statuses from './statuses'; +import meta from './meta'; export default combineReducers({ - statuses + statuses, + meta }); diff --git a/app/assets/javascripts/components/reducers/meta.jsx b/app/assets/javascripts/components/reducers/meta.jsx new file mode 100644 index 000000000..401be435d --- /dev/null +++ b/app/assets/javascripts/components/reducers/meta.jsx @@ -0,0 +1,13 @@ +import { SET_ACCESS_TOKEN } from '../actions/meta'; +import Immutable from 'immutable'; + +const initialState = Immutable.Map(); + +export default function meta(state = initialState, action) { + switch(action.type) { + case SET_ACCESS_TOKEN: + return state.set('access_token', action.token); + default: + return state; + } +} -- cgit