diff --git a/README.md b/README.md index 1f26b8e..24dc98b 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,13 @@ See the [Features](#features) for more functionalities - [x] lazy load (vue-lazyload) - [x] crop with cropperjs - [x] lightbox with buefy/bulma -- [x] dotenv - [x] custom error page - simple - [x] global notification - [x] toaster notification - [x] tooltips -- [x] force logout if token is invalid +- [x] force logout if token is invalid +- [x] dotenv +- [x] rxJS - [x] uuid - [x] slug - [ ] better formatting diff --git a/src/components/Loading.vue b/src/components/Loading.vue index 259ffe1..096742d 100644 --- a/src/components/Loading.vue +++ b/src/components/Loading.vue @@ -1,22 +1,10 @@ + diff --git a/src/nuxt.config.ts b/src/nuxt.config.ts index b00fc45..86a59c3 100644 --- a/src/nuxt.config.ts +++ b/src/nuxt.config.ts @@ -26,8 +26,8 @@ const config: Configuration = { /* ** Customize the progress-bar color */ - loading: { color: '#9400d3' }, - // loading: './components/Loading.vue', + // loading: { color: '#9400d3' }, + loading: './components/Loading.vue', /* ** Global CSS diff --git a/src/plugins/firebase-auth-listener.ts b/src/plugins/firebase-auth-listener.ts index 7b8a6be..1f5c527 100644 --- a/src/plugins/firebase-auth-listener.ts +++ b/src/plugins/firebase-auth-listener.ts @@ -49,6 +49,8 @@ const firebaseAuthListenerPlugin: Plugin = ({ store, app, route, redirect }) => return resolve() } + console.log('firebaseAuthListenerPlugin called with a user: ', !!firebaseUser) + let storedUser = getStoredUser(firebaseUser) store.commit(StoreConfig.auth.setStoredUser, storedUser) diff --git a/src/store/auth.ts b/src/store/auth.ts index ab610bf..cd23e78 100644 --- a/src/store/auth.ts +++ b/src/store/auth.ts @@ -32,8 +32,9 @@ import UserCredential = firebase.auth.UserCredential; import ActionCodeInfo = firebase.auth.ActionCodeInfo; export const state = (): AuthState => ({ + storedUser: undefined, forceLogout: false, - rememberMe: true + rememberMe: true, }) export const getters: GetterTree = { diff --git a/src/store/index.ts b/src/store/index.ts index 29c0c7e..8cdc230 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -15,9 +15,7 @@ export const state = (): RootState => ({}) export const actions: ActionTree = { async nuxtServerInit({ commit, dispatch, state }, { route, app }: Context) { commit(StoreConfig.loading.setLoading, true) - console.log( - `>>>>>>>>>> nuxtServerInit loading: ${state?.loading?.loading} mode: ${process?.mode} for path: ${route.path}` - ) + console.log(`>>>>>>>>>> nuxtServerInit for path: ${route.path}`) const token = app.$cookies.get(AppCookie.TOKEN) if (token) { @@ -27,7 +25,7 @@ export const actions: ActionTree = { token, }) .then((response: AxiosResponse) => { - console.log('decoed User on Server') + console.log('decoded User on Server') commit(StoreConfig.auth.setStoredUser, response.data) }) .catch((error: AxiosError) => { @@ -41,6 +39,8 @@ export const actions: ActionTree = { } }) .then(() => commit(StoreConfig.loading.setLoading, false)) + } else { + console.log('No token') } return dispatch(StoreConfig.loading.saveLoading, false) }, diff --git a/src/types/index.ts b/src/types/index.ts index ed0cf81..3d95de6 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -42,8 +42,8 @@ export enum AppCookie { REMEMBER_ME = 'rememberMe' } -export const cookieOptions: CookieSerializeOptions = { sameSite: 'lax' } +export const cookieOptions: CookieSerializeOptions = { sameSite: 'lax', path: '/' } -export const sessionCookieOptionsDev: CookieSerializeOptions = { sameSite: 'none' } +export const sessionCookieOptionsDev: CookieSerializeOptions = { sameSite: 'none', path: '/' } -export const sessionCookieOptionsProd: CookieSerializeOptions = { sameSite: 'none', secure: true } +export const sessionCookieOptionsProd: CookieSerializeOptions = { sameSite: 'none', secure: true, path: '/' }