Skip to content

Commit

Permalink
fix: access token problem
Browse files Browse the repository at this point in the history
  • Loading branch information
abdahmed22 committed Sep 10, 2024
1 parent d823ec2 commit d696ee5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion client/src/api/axios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ export const axios = axiosClient.create({
timeout: 1000,
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + localStorage.getItem('TEST_TRACKER_ACCESS_TOKEN'),
Authorization: localStorage.getItem('TEST_TRACKER_ACCESS_TOKEN') ? 'Bearer ' + localStorage.getItem('TEST_TRACKER_ACCESS_TOKEN') : '',
},
})
1 change: 0 additions & 1 deletion client/src/api/userService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ export async function putSettings (settings :Partial<UserProfile>) {
}

export async function putPassword (passwords :Partial<Password>) {
// localStorage.setItem('TTPHASH', md5(passwords.new_password!)) // only apply when the request succeeds
return axios.put('/auth/change-password/', passwords)
}
1 change: 1 addition & 0 deletions client/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ router.beforeEach((to, from, next) => {
const routeStore = useCurrentRouteStore()
const authRoutes = ['signup', 'signup-invitation', 'login']
const routeName = to.name
console.log('to', routeName)

if (!localStorage.getItem('TEST_TRACKER_ACCESS_TOKEN') && !authRoutes.includes(routeName)) {
routeStore.changeCurrentRoute('login')
Expand Down

0 comments on commit d696ee5

Please sign in to comment.