@nitra/vite-boot 5.0.7 → 5.0.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/src/user.js +10 -4
package/package.json
CHANGED
package/src/user.js
CHANGED
|
@@ -45,18 +45,24 @@ function intersection(a, b) {
|
|
|
45
45
|
/**
|
|
46
46
|
* Переводимо в анонімного користувача
|
|
47
47
|
*/
|
|
48
|
-
export function cleanToken() {
|
|
48
|
+
export async function cleanToken() {
|
|
49
|
+
console.log('Cleaning token and user data')
|
|
49
50
|
unsetUser()
|
|
50
51
|
|
|
51
|
-
console.log('Cleaning token by domain:', import.meta.env.VITE_DOMAIN)
|
|
52
52
|
// видаляємо з localStorage
|
|
53
53
|
localStorage.removeItem('__session')
|
|
54
54
|
|
|
55
55
|
if (globalThis.cookieStore && typeof globalThis.cookieStore.delete === 'function') {
|
|
56
|
-
|
|
56
|
+
let safeDomain = import.meta.env.VITE_DOMAIN
|
|
57
|
+
|
|
58
|
+
if (typeof safeDomain === 'string' && safeDomain.startsWith('.')) {
|
|
59
|
+
safeDomain = safeDomain.slice(1)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
await globalThis.cookieStore.delete({
|
|
57
63
|
name: '__session',
|
|
58
64
|
path: '/',
|
|
59
|
-
domain:
|
|
65
|
+
domain: safeDomain
|
|
60
66
|
})
|
|
61
67
|
} else {
|
|
62
68
|
// @ts-ignore
|