mirror of
https://github.com/immich-app/immich.git
synced 2025-12-23 17:25:11 +03:00
feat(web): automatically update user info (#5647)
* use svelte store * fix: websocket error when not authenticated * more routes
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { get, writable } from 'svelte/store';
|
||||
import type { UserResponseDto } from '@api';
|
||||
|
||||
export const user = writable<UserResponseDto | null>(null);
|
||||
export const user = writable<UserResponseDto>();
|
||||
|
||||
export const setUser = (value: UserResponseDto | null) => {
|
||||
export const setUser = (value: UserResponseDto) => {
|
||||
user.set(value);
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import type { AssetResponseDto, ServerVersionResponseDto } from '@api';
|
||||
import { Socket, io } from 'socket.io-client';
|
||||
import { writable } from 'svelte/store';
|
||||
import { loadConfig } from './server-config.store';
|
||||
import { getSavedUser } from './user.store';
|
||||
|
||||
export interface ReleaseEvent {
|
||||
isAvailable: boolean;
|
||||
@@ -25,7 +26,7 @@ let websocket: Socket | null = null;
|
||||
|
||||
export const openWebsocketConnection = () => {
|
||||
try {
|
||||
if (websocket) {
|
||||
if (websocket || !getSavedUser()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user