update share param

This commit is contained in:
lingdocs 2022-07-23 22:55:50 -05:00
parent 672f4d1f7b
commit cedf4037ff
3 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@lingdocs/pashto-inflector", "name": "@lingdocs/pashto-inflector",
"version": "3.5.1", "version": "3.5.2",
"author": "lingdocs.com", "author": "lingdocs.com",
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations", "description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
"homepage": "https://verbs.lingdocs.com", "homepage": "https://verbs.lingdocs.com",

View File

@ -12,7 +12,7 @@ import autoAnimate from "@formkit/auto-animate";
// @ts-ignore // @ts-ignore
import LZString from "lz-string"; import LZString from "lz-string";
import EPPicker from "./EPPicker"; import EPPicker from "./EPPicker";
const phraseURLParam = "EPhrase"; const epPhraseURLParam = "ep";
const blankEps: T.EPSelectionState = { const blankEps: T.EPSelectionState = {
blocks: makeEPSBlocks(), blocks: makeEPSBlocks(),
@ -162,8 +162,8 @@ function getShareUrl(eps: T.EPSelectionState): string {
const url = new URL(window.location.href); const url = new URL(window.location.href);
// need to delete or else you could just get a second param written after // need to delete or else you could just get a second param written after
// which gets ignored // which gets ignored
url.searchParams.delete(phraseURLParam); url.searchParams.delete(epPhraseURLParam);
url.searchParams.append(phraseURLParam, encoded); url.searchParams.append(epPhraseURLParam, encoded);
return url.toString(); return url.toString();
} }
@ -173,7 +173,7 @@ function getCode(eps: T.EPSelectionState): string {
function getEPSFromUrl(): T.EPSelectionState | undefined { function getEPSFromUrl(): T.EPSelectionState | undefined {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const fromParams = params.get(phraseURLParam); const fromParams = params.get(epPhraseURLParam);
if (!fromParams) return; if (!fromParams) return;
const decoded = LZString.decompressFromEncodedURIComponent(fromParams); const decoded = LZString.decompressFromEncodedURIComponent(fromParams);
return JSON.parse(decoded) as T.EPSelectionState; return JSON.parse(decoded) as T.EPSelectionState;

View File

@ -15,7 +15,7 @@ import { vpsReducer } from "./vps-reducer";
import { getObjectSelection } from "../../lib/phrase-building/blocks-utils"; import { getObjectSelection } from "../../lib/phrase-building/blocks-utils";
import VPPicker from "./VPPicker"; import VPPicker from "./VPPicker";
const phraseURLParam = "VPhrase"; export const vpPhraseURLParam = "vp";
// TODO: Issue with dynamic compounds english making with plurals // TODO: Issue with dynamic compounds english making with plurals
// TODO: Issue with "the money were taken" // TODO: Issue with "the money were taken"
@ -205,8 +205,8 @@ function getShareUrl(vps: T.VPSelectionState): string {
const url = new URL(window.location.href); const url = new URL(window.location.href);
// need to delete or else you could just get a second param written after // need to delete or else you could just get a second param written after
// which gets ignored // which gets ignored
url.searchParams.delete(phraseURLParam); url.searchParams.delete(vpPhraseURLParam);
url.searchParams.append(phraseURLParam, encoded); url.searchParams.append(vpPhraseURLParam, encoded);
return url.toString(); return url.toString();
} }
@ -216,7 +216,7 @@ function getCode(vps: T.VPSelectionState): string {
function getVPSFromUrl(): T.VPSelectionState | undefined { function getVPSFromUrl(): T.VPSelectionState | undefined {
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const fromParams = params.get(phraseURLParam); const fromParams = params.get(vpPhraseURLParam);
if (!fromParams) return; if (!fromParams) return;
const decoded = LZString.decompressFromEncodedURIComponent(fromParams); const decoded = LZString.decompressFromEncodedURIComponent(fromParams);
return JSON.parse(decoded) as T.VPSelectionState; return JSON.parse(decoded) as T.VPSelectionState;