| 123456789101112131415161718192021222324252627282930 |
- import { apiSlice } from "@features/api/apiSlice";
-
- export const authApiSlice = apiSlice.injectEndpoints({
- endpoints: (builder) => ({
- login: builder.mutation({
- providesTags: ["User"],
- query: (credentials) => ({
- url: "/auth/local",
- method: "POST",
- body: { ...credentials },
- }),
- }),
- register: builder.mutation({
- query: (credentials) => ({
- url: "/auth/local/register",
- method: "POST",
- body: { ...credentials },
- }),
- }),
- authProvider: builder.mutation({
- query: ({ provider, accessToken }) => ({
- url: `/auth/${provider}/callback?access_token=${accessToken}`,
- method: 'GET'
- }),
- }),
- }),
- });
-
- export const { useLoginMutation, useRegisterMutation, useAuthProviderMutation } =
- authApiSlice;
|