Skip to content

Commit

Permalink
add api foundation
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed May 31, 2024
1 parent 9677678 commit 814b47c
Show file tree
Hide file tree
Showing 10 changed files with 544 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_API_BASE_URL=REPLACE_ME
18 changes: 18 additions & 0 deletions src/api/authFactor.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { type Model } from "codeforlife/lib/esm/helpers/rtkQuery"

Check failure on line 1 in src/api/authFactor.ts

View workflow job for this annotation

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

Cannot find module 'codeforlife/lib/esm/helpers/rtkQuery' or its corresponding type declarations.

import api from "."

export type AuthFactor = Model<
number,
{
user: number
type: "otp"
}
>

const authFactorApi = api.injectEndpoints({
endpoints: build => ({}),
})

export default authFactorApi
export const {} = authFactorApi
11 changes: 11 additions & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"

const api = createApi({
baseQuery: fetchBaseQuery({
baseUrl: import.meta.env.VITE_API_BASE_URL,
}),
tagTypes: ["User", "Teacher", "Student", "School", "Class"],
endpoints: () => ({}),
})

export default api
21 changes: 21 additions & 0 deletions src/api/klass.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { type Model } from "codeforlife/lib/esm/helpers/rtkQuery"

Check failure on line 1 in src/api/klass.ts

View workflow job for this annotation

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

Cannot find module 'codeforlife/lib/esm/helpers/rtkQuery' or its corresponding type declarations.

import api from "."

export type Class = Model<
string,
{
name: string
teacher: number
school: number
read_classmates_data: boolean
receive_requests_until?: Date
}
>

const classApi = api.injectEndpoints({
endpoints: build => ({}),
})

export default classApi
export const {} = classApi
8 changes: 8 additions & 0 deletions src/api/otpBypassToken.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import api from "."

const otpBypassTokenApi = api.injectEndpoints({
endpoints: build => ({}),
})

export default otpBypassTokenApi
export const {} = otpBypassTokenApi
Loading

0 comments on commit 814b47c

Please sign in to comment.