Cleanup unused refresh stuff in auth

stable/1.0.x
Alex Gleason 2020-04-29 18:29:41 -05:00
rodzic ac660c2485
commit 3c159460eb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 2 dodań i 18 usunięć

Wyświetl plik

@ -12,11 +12,12 @@ export const AUTH_REGISTER_SUCCESS = 'AUTH_REGISTER_SUCCESS';
export const AUTH_REGISTER_FAIL = 'AUTH_REGISTER_FAIL'; export const AUTH_REGISTER_FAIL = 'AUTH_REGISTER_FAIL';
const hasAppToken = getState => getState().hasIn(['auth', 'app', 'access_token']); const hasAppToken = getState => getState().hasIn(['auth', 'app', 'access_token']);
const noOp = () => () => new Promise(f => f());
export function initAuthApp() { export function initAuthApp() {
return (dispatch, getState) => { return (dispatch, getState) => {
const hasToken = hasAppToken(getState); const hasToken = hasAppToken(getState);
const action = hasToken ? refreshAppToken : createAppAndToken; const action = hasToken ? noOp : createAppAndToken;
return dispatch(action()) return dispatch(action())
.catch(error => { .catch(error => {
dispatch(showAlertForError(error)); dispatch(showAlertForError(error));
@ -64,23 +65,6 @@ function createAppToken() {
}; };
} }
function refreshAppToken() {
return (dispatch, getState) => {
// FIXME: Pleroma doesn't support this yet:
// https://git.pleroma.social/pleroma/pleroma/-/issues/1721
return dispatch(createAppToken());
// const app = getState().getIn(['auth', 'app']);
//
// return api(getState, 'app').post('/oauth/token', {
// grant_type: 'refresh_token',
// refresh_token: app.get('refresh_token'),
// }).then(response => {
// dispatch(authAppAuthorized(response.data));
// });
};
}
export function logIn(username, password) { export function logIn(username, password) {
return (dispatch, getState) => { return (dispatch, getState) => {
const app = getState().getIn(['auth', 'app']); const app = getState().getIn(['auth', 'app']);