diff --git a/src/client/helper/journey.ts b/src/client/helper/journey.ts index a919a2e..60cb5c1 100644 --- a/src/client/helper/journey.ts +++ b/src/client/helper/journey.ts @@ -1,4 +1,4 @@ -import journey_wrapper from './types/wrapper'; +import journey_wrapper from '../types/wrapper'; /* LIST HELPERS */ export const filter_selected = function (journey: journey_wrapper, list: geoloc[], step: boolean) { @@ -38,4 +38,15 @@ export const journey_del_place = function (journey: journey_wrapper, tpe: String case "flight": return journey.leg_get().travel.splice(idx, 1); 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') + } } \ No newline at end of file