This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| switch (action.type) { | |
| case "REFRESH_TOKEN_SUCCESS": | |
| state.userData.token = action.data.token; | |
| let t = window.confirm( | |
| "Session Habis\nSilakan Pilih OK untuk tetap login atau\nCancel untuk keluar" | |
| ); // eslint-disable-next-line | |
| t ? setUserData(state.userData) : localStorage.clear(); | |
| window.location.reload(); | |
| return state; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const errorHandler = (error, obj = { actionFailure: null }) => { | |
| if (error.response) { | |
| if (error.response.hasOwnProperty('status')) { | |
| if ( | |
| error.response.status === 401 && | |
| error.response.data === 'Unauthorized' | |
| ) { | |
| store.dispatch(RefreshToken()); | |
| } else if (error.response.status === 500) { | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { encrypt, decrypt } from "./crypto"; | |
| export const setUserData = str => { | |
| localStorage.setItem("T_T", encrypt(JSON.stringify(str))); | |
| }; | |
| export const getUserData = () => { | |
| return localStorage.getItem("T_T") | |
| ? JSON.parse(decrypt(localStorage.getItem("T_T"))) | |
| : {}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import CryptoJS from "crypto-js"; | |
| let secretKeyAES = "gunnrosez"; | |
| let secretKeyRC4 = "thisisthestrongestsecretkey"; | |
| const encryptAES = str => { | |
| return CryptoJS.AES.encrypt(str, secretKeyAES).toString(); | |
| }; | |
| const decryptAES = str => { |