Merge branch 'revoke' into 'develop'

Fix /oauth/revoke 404

See merge request soapbox-pub/soapbox!2515
This commit is contained in:
Alex Gleason 2023-05-18 16:49:30 +00:00
commit 881c8083d2

View file

@ -6,6 +6,8 @@
* @see module:soapbox/actions/auth
*/
import { getBaseURL } from 'soapbox/utils/state';
import { baseClient } from '../api';
import type { AppDispatch } from 'soapbox/store';
@ -31,9 +33,10 @@ export const obtainOAuthToken = (params: Record<string, string | undefined>, bas
};
export const revokeOAuthToken = (params: Record<string, string>) =>
(dispatch: AppDispatch) => {
(dispatch: AppDispatch, getState: () => RootState) => {
dispatch({ type: OAUTH_TOKEN_REVOKE_REQUEST, params });
return baseClient().post('/oauth/revoke', params).then(({ data }) => {
const baseURL = getBaseURL(getState());
return baseClient(null, baseURL).post('/oauth/revoke', params).then(({ data }) => {
dispatch({ type: OAUTH_TOKEN_REVOKE_SUCCESS, params, data });
return data;
}).catch(error => {