Skip to content

Commit

Permalink
docs(auth): add a logging step and remove extra notes build_image
Browse files Browse the repository at this point in the history
  • Loading branch information
brucetony committed Aug 13, 2024
1 parent 61c783f commit bf5dbca
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions middleware/auth.global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const authFlowRoutes = [
"/auth/callback",
"/auth/silent-refresh",
"/auth/logout",
"/",
];

export default defineNuxtRouteMiddleware(async (to, from) => {
Expand All @@ -14,8 +15,9 @@ export default defineNuxtRouteMiddleware(async (to, from) => {

if (!user && !authFlowRoutes.includes(to.path)) {
// use this to automatically force a sign in and redirect
// services.$auth.signInRedirect();
console.warn("Not logged in");
return await services.$auth.signInRedirect();
} else {
authStore.setUpUserCredentials(user);
return authStore.setUpUserCredentials(user);
}
});
2 changes: 0 additions & 2 deletions services/application-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ export default class ApplicationService {
getToken() {
return this.accessToken;
}

// use this to add to API calls or the like
}
1 change: 1 addition & 0 deletions stores/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const useAuth = defineStore("auth", () => {
};
});

// Allows changes made to the store code to be applied automatically without having to restart the app
if (import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useAuth, import.meta.hot));
}

0 comments on commit bf5dbca

Please sign in to comment.