2025-05-20 18:08:51 -07:00
|
|
|
import { toast } from '/@/renderer/components';
|
2023-06-13 17:52:51 +00:00
|
|
|
import { useAuthStore } from '/@/renderer/store';
|
2025-05-20 18:08:51 -07:00
|
|
|
import { ServerListItem } from '/@/shared/types/types';
|
2023-06-13 17:52:51 +00:00
|
|
|
|
2025-05-18 14:03:18 -07:00
|
|
|
export const authenticationFailure = (currentServer: null | ServerListItem) => {
|
2023-07-01 19:10:05 -07:00
|
|
|
toast.error({
|
|
|
|
|
message: 'Your session has expired.',
|
|
|
|
|
});
|
2023-06-13 17:52:51 +00:00
|
|
|
|
2023-07-01 19:10:05 -07:00
|
|
|
if (currentServer) {
|
|
|
|
|
const serverId = currentServer.id;
|
|
|
|
|
const token = currentServer.ndCredential;
|
|
|
|
|
console.log(`token is expired: ${token}`);
|
|
|
|
|
useAuthStore.getState().actions.updateServer(serverId, { ndCredential: undefined });
|
|
|
|
|
useAuthStore.getState().actions.setCurrentServer(null);
|
|
|
|
|
}
|
2023-06-13 17:52:51 +00:00
|
|
|
};
|