config#RENEW_TOKEN TypeScript Examples

The following examples show how to use config#RENEW_TOKEN. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AuthService.tsx    From glific-frontend with GNU Affero General Public License v3.0 6 votes vote down vote up
renewAuthToken = () => {
  const renewalToken = getAuthSession('renewal_token');
  if (!renewalToken) {
    return new Error('Error');
  }
  // get the renewal token from session
  axios.defaults.headers.common.authorization = renewalToken;

  return axios
    .post(RENEW_TOKEN)
    .then((response: any) => response)
    .catch((error: any) => {
      // add log's
      setLogs(`renewalToken:${renewalToken} URL:${RENEW_TOKEN}`, 'info');
      setLogs(error, 'error');
      // if we are not able to renew the token for some weird reason or if refresh token
      throw error;
    });
}