Skip to content

Commit

Permalink
api issue solved lint change
Browse files Browse the repository at this point in the history
  • Loading branch information
RanaZaeem0 committed Sep 8, 2024
1 parent c0c2453 commit 8248853
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.env
node_modules
3 changes: 0 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,5 @@ jobs:
- name: Install dependencies
run: npm install

- name: Run lint
run: npm run lint

- name: Build project
run: npm run build
4 changes: 2 additions & 2 deletions src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ interface RefreshTokenResponse {
};
}

const token: string | boolean = getRefreshToken();
const token: string | null = getRefreshToken();
const baseURL: string = `${import.meta.env.VITE_BACKEND_URL}`;

const api: AxiosInstance = axios.create({
Expand All @@ -36,7 +36,7 @@ authApi.interceptors.request.use(async (req) => {
return req;
}

const {exp}: JwtPayload = jwtDecode<JwtPayload>(token);
const {exp}: JwtPayload = jwtDecode<JwtPayload>( token );
const isExpired: boolean = dayjs.unix(exp).diff(dayjs()) < 1;

if (!isExpired) {
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// utils/getRefreshToken.ts

// Function to get the refresh token from localStorage
export default function getRefreshToken(): string | boolean {
export default function getRefreshToken(): string | null {
const refreshToken = localStorage.getItem('refreshToken');

// Check if the refresh token is available and valid
if (refreshToken !== undefined && refreshToken !== "" && refreshToken !== null) {
return refreshToken;
} else {
return false; // Return null if the token is not available
return null; // Return null if the token is not available
}
}

0 comments on commit 8248853

Please sign in to comment.