Skip to content

Commit a30ec14

Browse files
authored
Merge pull request #11 from warrant-dev/UpdateWarrantJsV2
Update warrant js to v2
2 parents 60bcef4 + 6f5f09e commit a30ec14

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
"react-router-dom": "^5.2.0"
4949
},
5050
"dependencies": {
51-
"@warrantdev/warrant-js": "^1.1.0"
51+
"@warrantdev/warrant-js": "^2.0.0"
5252
}
5353
}

src/WarrantProvider.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import React, { useCallback, useEffect, useState } from "react";
2-
import { Client as WarrantClient } from "@warrantdev/warrant-js";
2+
import { Client as WarrantClient, WarrantCheck } from "@warrantdev/warrant-js";
33

4-
import { WarrantCheck } from "@warrantdev/warrant-js";
54
import WarrantContext from "./WarrantContext";
65

76
export interface AuthorizationProvider {
87
clientKey: string;
8+
endpoint?: string;
99
children: React.ReactNode;
1010
}
1111

1212
const LOCAL_STORAGE_KEY_SESSION_TOKEN = "__warrantSessionToken";
1313

1414
const WarrantProvider = (options: AuthorizationProvider): JSX.Element => {
15-
const { clientKey, children } = options;
15+
const { clientKey, endpoint, children } = options;
1616
const [sessionToken, setSessionToken] = useState<string>("");
1717
const [isLoading, setIsLoading] = useState<boolean>(false);
1818

@@ -35,7 +35,7 @@ const WarrantProvider = (options: AuthorizationProvider): JSX.Element => {
3535
}
3636

3737
setIsLoading(true);
38-
const isAuthorized = await new WarrantClient(clientKey, sessionToken).isAuthorized(warrantCheck);
38+
const isAuthorized = await new WarrantClient({ clientKey, sessionToken, endpoint }).isAuthorized(warrantCheck);
3939
setIsLoading(false);
4040

4141
return isAuthorized;

0 commit comments

Comments
 (0)