mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
#151: notify an api about user being logged out
This commit is contained in:
@@ -2,6 +2,7 @@ import { routeActions } from 'react-router-redux';
|
|||||||
|
|
||||||
import request from 'services/request';
|
import request from 'services/request';
|
||||||
import accounts from 'services/api/accounts';
|
import accounts from 'services/api/accounts';
|
||||||
|
import authentication from 'services/api/authentication';
|
||||||
import { setLocale } from 'components/i18n/actions';
|
import { setLocale } from 'components/i18n/actions';
|
||||||
|
|
||||||
export const UPDATE = 'USER_UPDATE';
|
export const UPDATE = 'USER_UPDATE';
|
||||||
@@ -45,6 +46,7 @@ export function setUser(payload) {
|
|||||||
|
|
||||||
export function logout() {
|
export function logout() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
|
authentication.logout();
|
||||||
dispatch(setUser({
|
dispatch(setUser({
|
||||||
lang: getState().user.lang,
|
lang: getState().user.lang,
|
||||||
isGuest: true
|
isGuest: true
|
||||||
@@ -107,7 +109,6 @@ export function authenticate(token, refreshToken) { // TODO: this action, probab
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
import authentication from 'services/api/authentication';
|
|
||||||
function requestAccessToken(refreshToken, dispatch) {
|
function requestAccessToken(refreshToken, dispatch) {
|
||||||
let promise;
|
let promise;
|
||||||
if (refreshToken) {
|
if (refreshToken) {
|
||||||
|
@@ -12,6 +12,10 @@ export default {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
return request.post('/api/authentication/logout');
|
||||||
|
},
|
||||||
|
|
||||||
refreshToken(refresh_token) {
|
refreshToken(refresh_token) {
|
||||||
return request.post(
|
return request.post(
|
||||||
'/api/authentication/refresh-token',
|
'/api/authentication/refresh-token',
|
||||||
|
Reference in New Issue
Block a user