Skip to content

Commit

Permalink
add login page and logic
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmanAsh committed Aug 28, 2024
1 parent b4de41e commit 5cd748c
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/api/session.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { type SessionMetadata } from "../app/hooks"

export type LoginWithGithubResult = SessionMetadata
export type LoginWithGithubArg = { code: string }
export type LoginWithGitHubResult = SessionMetadata
export type LoginWithGitHubArg = { code: string }

import api from "."

const sessionApi = api.injectEndpoints({
endpoints: build => ({
loginWithGithub: build.mutation<LoginWithGithubResult, LoginWithGithubArg>({
loginWithGitHub: build.mutation<LoginWithGitHubResult, LoginWithGitHubArg>({
query: body => ({
url: "session/login/",
method: "POST",
Expand All @@ -17,5 +17,5 @@ const sessionApi = api.injectEndpoints({
}),
})

export const { useLoginWithGithubMutation } = sessionApi
export default sessionApi
export const { useLoginWithGitHubMutation } = sessionApi
Binary file added src/images/github-mark-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const Home: FC<HomeProps> = () => {
<Link to={paths.contributors._}>Contributors list </Link>
<br></br>
<Link to={paths.agreementSignatures._}> Agreement signatures list</Link>
<br></br>
<Link to={paths.login._}> Login with github</Link>
</pages.Section>
</pages.Page>
)
Expand Down
2 changes: 2 additions & 0 deletions src/routes/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import agreementSignature from "./agreementSignature"
import contributor from "./contributor"
import general from "./general"
import login from "./login"
import paths from "./paths"

const routes = (
<>
{general}
{contributor}
{agreementSignature}
{login}
</>
)

Expand Down
12 changes: 12 additions & 0 deletions src/routes/login.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Route } from "react-router-dom"

import GitHub from "../pages/login/GitHub"

Check failure on line 3 in src/routes/login.tsx

View workflow job for this annotation

GitHub Actions / main / test / test-js-code

Cannot find module '../pages/login/GitHub' or its corresponding type declarations.
import paths from "./paths"

const login = (
<>
<Route path={paths.login._} element={<GitHub />} />
</>
)

export default login
1 change: 1 addition & 0 deletions src/routes/paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const paths = _("", {
agreementSignatures: _("/agreement-signatures", {
id: _("/:id"),
}),
login: _("/login"),
})

export default paths

0 comments on commit 5cd748c

Please sign in to comment.