Skip to content

Commit

Permalink
add login endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
SalmanAsh committed Aug 27, 2024
1 parent 5f34647 commit 1516850
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/api/session.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { type SessionMetadata } from "../app/hooks"

const baseUrl = "session/"
export type LoginWithGithubResult = SessionMetadata
export type LoginWithGithubArg = { code: string }

import api from "."

const sessionApi = api.injectEndpoints({
endpoints: build => ({
loginWithGithub: build.mutation<LoginWithGithubResult, LoginWithGithubArg>({
query: body => ({
url: baseUrl + "login-with-github/",
method: "POST",
body,
}),
}),
}),
})

export const { useLoginWithGithubMutation } = sessionApi
export default sessionApi

0 comments on commit 1516850

Please sign in to comment.