From 50d3d4080a5b8bf0819e168aa2301e3124a55300 Mon Sep 17 00:00:00 2001 From: Mel Date: Thu, 17 Feb 2022 22:26:29 +0100 Subject: Set concrete client type during initialization. --- assets/src/utils/getShareToken.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'assets/src/utils') diff --git a/assets/src/utils/getShareToken.ts b/assets/src/utils/getShareToken.ts index bfe6f58..b470695 100644 --- a/assets/src/utils/getShareToken.ts +++ b/assets/src/utils/getShareToken.ts @@ -1,4 +1,12 @@ -export default (): string => { +import { isClientRequest } from "../stores/constant_state"; + +export default function (): string { + if (!isClientRequest()) { + throw new Error( + "Client is not requesting so it does not have a share token." + ); + } + const splitPath = window.location.pathname.split("/"); return splitPath[splitPath.length - 1]; -}; +} -- cgit 1.4.1