-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add authentication context + ssr (#57)
* add authentication context + ssr * fix lint
- Loading branch information
1 parent
5127590
commit e4fed31
Showing
28 changed files
with
341 additions
and
261 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
ApolloClient, | ||
ApolloProvider, | ||
NormalizedCacheObject, | ||
} from "@apollo/client"; | ||
|
||
export const ApolloServerProvider = ({ | ||
client, | ||
children, | ||
}: { | ||
client: ApolloClient<NormalizedCacheObject>; | ||
children: React.ReactNode; | ||
}) => { | ||
return <ApolloProvider client={client}>{children}</ApolloProvider>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
app/contexts/authentication/AuthenticationServerProvider.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { User } from "~/models/user"; | ||
import { AuthenticationContext } from "./authenticationContext"; | ||
|
||
export const AuthenticationServerProvider = ({ | ||
user, | ||
children, | ||
}: { | ||
user: User | null; | ||
children: React.ReactNode; | ||
}) => { | ||
return ( | ||
<AuthenticationContext.Provider | ||
value={{ | ||
user: user, | ||
setUser: () => {}, | ||
isAuthenticated: user != null, | ||
}} | ||
> | ||
{children} | ||
</AuthenticationContext.Provider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
export * from "./authentication/authenticationContext"; | ||
export * from "./authentication/authenticationProvider"; | ||
export * from "./appApollo/appApolloProvider"; | ||
export * from "./authentication/AuthenticationClientProvider"; | ||
export * from "./authentication/AuthenticationServerProvider"; | ||
export * from "./apollo/apolloClientProvider"; | ||
export * from "./apollo/apolloServerProvider"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.