UI: переход на history-router без # и короткие ссылки тредов

This commit is contained in:
AidarKC
2026-05-19 10:15:15 +03:00
parent 3a0899bcfe
commit db2d9a666b
9 changed files with 61 additions and 28 deletions
+4 -4
View File
@@ -81,7 +81,8 @@ function messageRefKey(messageRef) {
function buildAbsoluteRouteUrl(routePath = '') {
const cleanRoute = String(routePath || '').replace(/^#?\/?/, '');
const url = new URL(window.location.href);
url.hash = `#/${cleanRoute}`;
url.pathname = `/${cleanRoute}`;
url.hash = '';
return url.toString();
}
@@ -213,7 +214,6 @@ function buildThreadRouteFromTarget(target, selector) {
'm',
encodeRoutePart(target.blockchainName),
target.blockNumber,
normalizeRouteHash(target.blockHash),
].join('/');
}
@@ -525,7 +525,7 @@ export function render({ navigate, route }) {
const next = render({ navigate, route });
current.replaceWith(next);
} catch (error) {
logThreadRuntimeError('rerender', error, { routeHash: window.location.hash });
logThreadRuntimeError('rerender', error, { routePath: window.location.pathname });
}
};
@@ -543,7 +543,7 @@ export function render({ navigate, route }) {
const login = state.session.login;
const storagePwd = state.session.storagePwdInMemory;
if (!login || !storagePwd) {
state.authReturnHash = window.location.hash || '#/channels-list';
state.authReturnHash = window.location.pathname || '/channels-list';
navigate('login-view');
throw new Error('Для этого действия нужно войти');
}