Update src/client/helper/journey.ts
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
sora-ext 2025-03-10 17:23:07 +01:00
parent c8118fabe4
commit b5918a47cb

View File

@ -1,4 +1,4 @@
import journey_wrapper from './types/wrapper'; import journey_wrapper from '../types/wrapper';
/* LIST HELPERS */ /* LIST HELPERS */
export const filter_selected = function (journey: journey_wrapper, list: geoloc[], step: boolean) { export const filter_selected = function (journey: journey_wrapper, list: geoloc[], step: boolean) {
@ -39,3 +39,14 @@ export const journey_del_place = function (journey: journey_wrapper, tpe: String
default: return true; default: return true;
} }
} }
export const journey_from_url = function () {
const path = window.location.pathname.slice(1).split('/')
const hash = window.location.hash.slice(1).split('_')
return {
edit: ["view", "short"].indexOf(path.at(0) || "") == -1,
id: path.at(-1) || String.gen_id(16).toString(),
leg: parseInt(hash.at(0) || '0'),
day: parseInt(hash.at(1) || '0')
}
}