Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

fix: issue #16 #39

Closed
wants to merge 1 commit into from
Closed

fix: issue #16 #39

wants to merge 1 commit into from

Conversation

yoution
Copy link
Contributor

@yoution yoution commented Dec 30, 2020

@maxceem please review, Automatically get token during API requests using Axios

Copy link
Contributor

@maxceem maxceem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick PR @yoution.

It works good for me, but there are few improvements for code I've commented in the code.

Also, please don't add places with broken lint:

image

@@ -0,0 +1,43 @@
import axios from "axios";
import store from "../store";
import { getFreshToken, isTokenExpired } from "@topcoder-platform/tc-auth-lib";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoution we should not use @topcoder-platform/tc-auth-lib directly. We should always getAuthUserTokens from @topcoder/micro-frontends-navbar-app


// request interceptor to pass auth token
axiosInstance.interceptors.request.use((config) => {
return getToken()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yoution just replace this line with getAuthUserTokens and then(({ tokenV3: token }) => { - something like this. We don't need refresh token logic, method getAuthUserTokens should do this for us.

yoution added a commit to yoution/taas-app that referenced this pull request Jan 3, 2021
@maxceem
Copy link
Contributor

maxceem commented Jan 6, 2021

@yoution I'm closing this PR, as you've created a new PR #40 with this work included.

@maxceem maxceem closed this Jan 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants