@data-fair/lib-vue 1.13.6 → 1.13.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/session.d.ts +1 -1
- package/session.js +4 -2
package/package.json
CHANGED
package/session.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type Ref, type ComputedRef, type App } from 'vue';
|
|
|
3
3
|
import { type RouteLocation } from 'vue-router';
|
|
4
4
|
import { type fetch } from 'ofetch';
|
|
5
5
|
import { type SessionState, type SessionStateAuthenticated } from '@data-fair/lib-common-types/session/index.js';
|
|
6
|
-
export
|
|
6
|
+
export * from '@data-fair/lib-common-types/session/index.js';
|
|
7
7
|
interface GenericCookies {
|
|
8
8
|
get: (key: string) => string | undefined;
|
|
9
9
|
set: (key: string, value: string, options?: Record<string, any>) => void;
|
package/session.js
CHANGED
|
@@ -5,6 +5,7 @@ import { jwtDecode } from 'jwt-decode'
|
|
|
5
5
|
import cookiesModule from 'universal-cookie'
|
|
6
6
|
import Debug from 'debug'
|
|
7
7
|
import inIframe from '@data-fair/lib-utils/in-iframe.js'
|
|
8
|
+
export * from '@data-fair/lib-common-types/session/index.js'
|
|
8
9
|
const Cookies = cookiesModule
|
|
9
10
|
const debug = Debug('session')
|
|
10
11
|
debug.log = console.log.bind(console)
|
|
@@ -168,8 +169,9 @@ export async function getSession (initOptions) {
|
|
|
168
169
|
goTo(redirect ?? options.logoutRedirectUrl ?? null)
|
|
169
170
|
}
|
|
170
171
|
const switchOrganization = (org, dep) => {
|
|
171
|
-
|
|
172
|
-
if (
|
|
172
|
+
const cookieOpts = { path: cookiesPath }
|
|
173
|
+
if (org) { cookies.set('id_token_org', org, cookieOpts) } else { cookies.remove('id_token_org', cookieOpts) }
|
|
174
|
+
if (dep) { cookies.set('id_token_dep', dep, cookieOpts) } else { cookies.remove('id_token_dep', cookieOpts) }
|
|
173
175
|
readState()
|
|
174
176
|
}
|
|
175
177
|
const setAdminMode = async (adminMode, redirect) => {
|