Skip to content

Commit

Permalink
run prettier on everything
Browse files Browse the repository at this point in the history
  • Loading branch information
cmatheson committed Sep 16, 2024
1 parent 551478a commit f5cb927
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"

- name: Install Dependencies
run: |
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,30 +91,30 @@ function App() {
Your app should be wrapped in the `AuthKitProvider` component. This component
takes the following props:
* `clientId` (required): Your `WORKOS_CLIENT_ID`
* `apiHostname`: Defaults to `api.workos.com`. This should be set to your custom Authentication API domain in production.
* `redirectUri`: The url that WorkOS will redirect to upon successful authentication. (Used when constructing sign-in/sign-up URLs).
* `devMode`: Defaults to `true` if window.location is "localhost" or "127.0.0.1". Tokens will be stored in localStorage when this prop is true.
* `onRedirectCallback`: Called after exchanging the
- `clientId` (required): Your `WORKOS_CLIENT_ID`
- `apiHostname`: Defaults to `api.workos.com`. This should be set to your custom Authentication API domain in production.
- `redirectUri`: The url that WorkOS will redirect to upon successful authentication. (Used when constructing sign-in/sign-up URLs).
- `devMode`: Defaults to `true` if window.location is "localhost" or "127.0.0.1". Tokens will be stored in localStorage when this prop is true.
- `onRedirectCallback`: Called after exchanging the
`authorization_code`. Can be used for things like redirecting to a "return
to" path in the OAuth state.
### `useAuth`
The `useAuth` hook returns user information and helper functions:
* `isLoading`: true while user information is being obtained from fetch during initial load.
* `user`: The WorkOS `User` object for this session.
* `getAccessToken`: Returns an access token. Will fetch a fresh access token if necessary.
* `signIn`: Redirects the user to the Hosted AuthKit sign-in page. Takes an optional `state` argument.
* `signUp`: Redirects the user to the Hosted AuthKit sign-up page. Takes an optional `state` argument.
* `signOut`: Ends the session.
- `isLoading`: true while user information is being obtained from fetch during initial load.
- `user`: The WorkOS `User` object for this session.
- `getAccessToken`: Returns an access token. Will fetch a fresh access token if necessary.
- `signIn`: Redirects the user to the Hosted AuthKit sign-in page. Takes an optional `state` argument.
- `signUp`: Redirects the user to the Hosted AuthKit sign-up page. Takes an optional `state` argument.
- `signOut`: Ends the session.
The following claims may be populated if the user is part of an organization:
* `organizationId`: The currently-selected organization.
* `role`: The `role` of the user for the current organization.
* `permissions`: Permissions corresponding to this role.
- `organizationId`: The currently-selected organization.
- `role`: The `role` of the user for the current organization.
- `permissions`: Permissions corresponding to this role.
## Impersonation
Expand Down
12 changes: 7 additions & 5 deletions src/context.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
'use client';
"use client";

import * as React from 'react';
import { Client } from './types';
import { State, initialState } from './state';
import * as React from "react";
import { Client } from "./types";
import { State, initialState } from "./state";

export interface ContextValue extends Client, State {}

export const Context = React.createContext<ContextValue>(initialState as ContextValue);
export const Context = React.createContext<ContextValue>(
initialState as ContextValue,
);
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { useAuth } from './hook';
export { AuthKitProvider } from './provider';
export { getClaims } from '@workos-inc/authkit-js';
export { useAuth } from "./hook";
export { AuthKitProvider } from "./provider";
export { getClaims } from "@workos-inc/authkit-js";
4 changes: 2 additions & 2 deletions src/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) {
return isEquivalentWorkOSSession(prev, next) ? prev : next;
});
},
[client]
[client],
);

React.useEffect(() => {
Expand Down Expand Up @@ -86,7 +86,7 @@ export function AuthKitProvider(props: AuthKitProviderProps) {
// poor-man's "deep equality" check
function isEquivalentWorkOSSession(
a: typeof initialState,
b: typeof initialState
b: typeof initialState,
) {
return (
a.user?.updatedAt === b.user?.updatedAt &&
Expand Down
2 changes: 1 addition & 1 deletion src/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { User } from '@workos-inc/authkit-js';
import { User } from "@workos-inc/authkit-js";

export interface State {
isLoading: boolean;
Expand Down
6 changes: 4 additions & 2 deletions src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { createClient } from '@workos-inc/authkit-js';
import { createClient } from "@workos-inc/authkit-js";

export type Client = Awaited<ReturnType<typeof createClient>>;
export type CreateClientOptions = NonNullable<Parameters<typeof createClient>[1]>;
export type CreateClientOptions = NonNullable<
Parameters<typeof createClient>[1]
>;

0 comments on commit f5cb927

Please sign in to comment.