Skip to content

Commit

Permalink
✨ Add google as OAuth provider
Browse files Browse the repository at this point in the history
  • Loading branch information
lowczarc committed Aug 14, 2023
1 parent 3bbc55d commit 0615b26
Show file tree
Hide file tree
Showing 3 changed files with 586 additions and 590 deletions.
6 changes: 4 additions & 2 deletions lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ export default Polyfact;

const reactMutex = new Mutex();

type Provider = "github" | "google";

export function usePolyfact({ project, endpoint }: { project: string; endpoint?: string }): {
polyfact: Client | undefined;
login: ((input: { provider: "github" }) => Promise<void>) | undefined;
login: ((input: { provider: Provider }) => Promise<void>) | undefined;
loading: boolean;
} {
if (typeof window === "undefined") {
Expand Down Expand Up @@ -302,7 +304,7 @@ export function usePolyfact({ project, endpoint }: { project: string; endpoint?:
setLoading(false);
setPolyfact(p);
} else {
setLogin(() => async ({ provider }: { provider: "github" }) => {
setLogin(() => async ({ provider }: { provider: Provider }) => {
await Polyfact.endpoint(endpoint || "https://api2.polyfact.com")
.project(project)
.signInWithOAuth({ provider });
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polyfact",
"version": "0.1.39",
"version": "0.1.40",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"author": "Lancelot Owczarczak <[email protected]>",
Expand Down
Loading

0 comments on commit 0615b26

Please sign in to comment.