update share param
This commit is contained in:
parent
672f4d1f7b
commit
cedf4037ff
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@lingdocs/pashto-inflector",
|
||||
"version": "3.5.1",
|
||||
"version": "3.5.2",
|
||||
"author": "lingdocs.com",
|
||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||
"homepage": "https://verbs.lingdocs.com",
|
||||
|
|
|
@ -12,7 +12,7 @@ import autoAnimate from "@formkit/auto-animate";
|
|||
// @ts-ignore
|
||||
import LZString from "lz-string";
|
||||
import EPPicker from "./EPPicker";
|
||||
const phraseURLParam = "EPhrase";
|
||||
const epPhraseURLParam = "ep";
|
||||
|
||||
const blankEps: T.EPSelectionState = {
|
||||
blocks: makeEPSBlocks(),
|
||||
|
@ -162,8 +162,8 @@ function getShareUrl(eps: T.EPSelectionState): string {
|
|||
const url = new URL(window.location.href);
|
||||
// need to delete or else you could just get a second param written after
|
||||
// which gets ignored
|
||||
url.searchParams.delete(phraseURLParam);
|
||||
url.searchParams.append(phraseURLParam, encoded);
|
||||
url.searchParams.delete(epPhraseURLParam);
|
||||
url.searchParams.append(epPhraseURLParam, encoded);
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ function getCode(eps: T.EPSelectionState): string {
|
|||
|
||||
function getEPSFromUrl(): T.EPSelectionState | undefined {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const fromParams = params.get(phraseURLParam);
|
||||
const fromParams = params.get(epPhraseURLParam);
|
||||
if (!fromParams) return;
|
||||
const decoded = LZString.decompressFromEncodedURIComponent(fromParams);
|
||||
return JSON.parse(decoded) as T.EPSelectionState;
|
||||
|
|
|
@ -15,7 +15,7 @@ import { vpsReducer } from "./vps-reducer";
|
|||
import { getObjectSelection } from "../../lib/phrase-building/blocks-utils";
|
||||
import VPPicker from "./VPPicker";
|
||||
|
||||
const phraseURLParam = "VPhrase";
|
||||
export const vpPhraseURLParam = "vp";
|
||||
|
||||
// TODO: Issue with dynamic compounds english making with plurals
|
||||
// TODO: Issue with "the money were taken"
|
||||
|
@ -205,8 +205,8 @@ function getShareUrl(vps: T.VPSelectionState): string {
|
|||
const url = new URL(window.location.href);
|
||||
// need to delete or else you could just get a second param written after
|
||||
// which gets ignored
|
||||
url.searchParams.delete(phraseURLParam);
|
||||
url.searchParams.append(phraseURLParam, encoded);
|
||||
url.searchParams.delete(vpPhraseURLParam);
|
||||
url.searchParams.append(vpPhraseURLParam, encoded);
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
|
@ -216,7 +216,7 @@ function getCode(vps: T.VPSelectionState): string {
|
|||
|
||||
function getVPSFromUrl(): T.VPSelectionState | undefined {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const fromParams = params.get(phraseURLParam);
|
||||
const fromParams = params.get(vpPhraseURLParam);
|
||||
if (!fromParams) return;
|
||||
const decoded = LZString.decompressFromEncodedURIComponent(fromParams);
|
||||
return JSON.parse(decoded) as T.VPSelectionState;
|
||||
|
|
Loading…
Reference in New Issue