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 nowmain
parent
44e57f64dd
commit
92afd29650
@ -0,0 +1,8 @@
|
|||||||
|
export const SET_ACCESS_TOKEN = 'SET_ACCESS_TOKEN';
|
||||||
|
|
||||||
|
export function setAccessToken(token) {
|
||||||
|
return {
|
||||||
|
type: SET_ACCESS_TOKEN,
|
||||||
|
token: token
|
||||||
|
};
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
import { combineReducers } from 'redux-immutable';
|
import { combineReducers } from 'redux-immutable';
|
||||||
import statuses from './statuses';
|
import statuses from './statuses';
|
||||||
|
import meta from './meta';
|
||||||
|
|
||||||
export default combineReducers({
|
export default combineReducers({
|
||||||
statuses
|
statuses,
|
||||||
|
meta
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1 @@
|
|||||||
= react_component 'Root', { timelines: { home: render(file: 'api/statuses/home', locals: { statuses: @home }, formats: :json), mentions: render(file: 'api/statuses/mentions', locals: { statuses: @mentions }, formats: :json) }}, class: 'app-holder', prerender: false
|
= react_component 'Root', { token: @token, timelines: { home: render(file: 'api/statuses/home', locals: { statuses: @home }, formats: :json), mentions: render(file: 'api/statuses/mentions', locals: { statuses: @mentions }, formats: :json) }}, class: 'app-holder', prerender: false
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
class AddSuperappToOauthApplications < ActiveRecord::Migration[5.0]
|
||||||
|
def change
|
||||||
|
add_column :oauth_applications, :superapp, :boolean, default: false, null: false
|
||||||
|
end
|
||||||
|
end
|
@ -1,7 +1,2 @@
|
|||||||
# This file should contain all the record creation needed to seed the database with its default values.
|
web_app = Doorkeeper::Application.new(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri)
|
||||||
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
web_app.save(validate: false)
|
||||||
#
|
|
||||||
# Examples:
|
|
||||||
#
|
|
||||||
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
|
||||||
# Mayor.create(name: 'Emanuel', city: cities.first)
|
|
||||||
|
Loading…
Reference in new issue