diff options
| author | Max Nanis | 2026-09-11 18:16:06 -0700 |
|---|---|---|
| committer | Max Nanis | 2026-09-11 18:16:06 -0700 |
| commit | 11d63b171501b9c29398133b795c3bcc1ae85a1b (patch) | |
| tree | 9ef60f1723357889f8bd72420a0c6f7ae5153fa1 /jb-ui/src/models | |
| parent | edff9381275d90d7be5f078430554ae592a27f5d (diff) | |
| download | amt-jb-11d63b171501b9c29398133b795c3bcc1ae85a1b.tar.gz amt-jb-11d63b171501b9c29398133b795c3bcc1ae85a1b.zip | |
using RTK with session login. start of magic token request
Diffstat (limited to 'jb-ui/src/models')
| -rw-r--r-- | jb-ui/src/models/authAPI.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/jb-ui/src/models/authAPI.ts b/jb-ui/src/models/authAPI.ts new file mode 100644 index 0000000..1ac7886 --- /dev/null +++ b/jb-ui/src/models/authAPI.ts @@ -0,0 +1,23 @@ +import { createApi, fetchBaseQuery } from "@reduxjs/toolkit/query/react"; + +export const authApi = createApi({ + reducerPath: "authApi", + baseQuery: fetchBaseQuery({ + baseUrl: "/auth", + credentials: "include", // sends the httpOnly cookie + }), + tagTypes: ["User"], + endpoints: (builder) => ({ + getMe: builder.query({ + query: () => "/session", + providesTags: ["User"], + }), + // logout: builder.mutation({ + // query: () => ({ url: "/de-session", method: "POST" }), + // invalidatesTags: ["User"], + // }), + }), +}); + +// export const { useGetMeQuery, useLogoutMutation } = authApi; +export const { useGetMeQuery } = authApi; |
