Merge branch 'add-translations' into backend-connection

This commit is contained in:
Delucse
2020-12-14 15:23:01 +01:00
45 changed files with 1033 additions and 548 deletions
+9 -2
View File
@@ -1,8 +1,8 @@
import { MYBADGES_CONNECT, MYBADGES_DISCONNECT, GET_STATUS, USER_LOADED, USER_LOADING, AUTH_ERROR, LOGIN_SUCCESS, LOGIN_FAIL, LOGOUT_SUCCESS, LOGOUT_FAIL, REFRESH_TOKEN_SUCCESS } from '../actions/types';
import axios from 'axios';
import { returnErrors, returnSuccess } from './messageActions'
import { returnErrors, returnSuccess } from './messageActions';
import { setLanguage } from './generalActions';
// Check token & load user
export const loadUser = () => (dispatch) => {
@@ -20,6 +20,7 @@ export const loadUser = () => (dispatch) => {
type: USER_LOADED,
payload: res.data.user
});
dispatch(setLanguage(res.data.user.language));
},
error: err => {
if(err.response){
@@ -77,6 +78,7 @@ export const login = ({ email, password }) => (dispatch) => {
type: GET_STATUS,
payload: res.data.user.status
});
dispatch(setLanguage(res.data.user.language));
dispatch(returnSuccess(res.data.message, res.status, 'LOGIN_SUCCESS'));
})
.catch(err => {
@@ -170,6 +172,11 @@ export const logout = () => (dispatch) => {
type: GET_STATUS,
payload: status
});
var locale = 'de_DE';
if (window.localStorage.getItem('locale')) {
locale = window.localStorage.getItem('locale');
}
dispatch(setLanguage(locale));
dispatch(returnSuccess(res.data.message, res.status, 'LOGOUT_SUCCESS'));
clearTimeout(logoutTimerId);
},