diff options
author | Michael Hunteman <michael@huntm.net> | 2024-02-28 18:20:38 -0800 |
---|---|---|
committer | Michael Hunteman <michael@huntm.net> | 2024-02-28 18:20:38 -0800 |
commit | fa1409d205479e9943f7b7db96a4b56ff1d29d7d (patch) | |
tree | 4010f01003d679940f422e72e0e291f9582172d7 /src/apiSlice.ts | |
parent | 064c11060f7a8e1ec5e1a128a7beabd7635991ca (diff) |
Resolve type errors
Diffstat (limited to 'src/apiSlice.ts')
-rw-r--r-- | src/apiSlice.ts | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/apiSlice.ts b/src/apiSlice.ts index fde9fff..ab46822 100644 --- a/src/apiSlice.ts +++ b/src/apiSlice.ts @@ -1,9 +1,10 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; -import { setCredentials, logOut } from './features/auth/authSlice'; +import { RootState } from './store' export interface User { firstName: string lastName: string + id: number } export interface UserResponse { @@ -16,10 +17,18 @@ export interface LoginRequest { lastName: string } +export interface Guest { + id: number + attendance: string + mealPreference: string + dietaryRestrictions: string + plusOne: string + marriageAdvice: string +} + export const apiSlice = createApi({ reducerPath: 'api', baseQuery: fetchBaseQuery({ - // baseUrl: 'http://localhost:3000', baseUrl: '/', prepareHeaders: (headers, { getState }) => { const token = (getState() as RootState).auth.token; @@ -31,11 +40,11 @@ export const apiSlice = createApi({ }), tagTypes: ['Guests'], endpoints: builder => ({ - getGuests: builder.query({ + getGuests: builder.query<void, void>({ query: () => '/guests', providesTags: ['Guests'] }), - updateGuest: builder.mutation({ + updateGuest: builder.mutation<Guest, Guest>({ query: guest => ({ url: `/guests/${guest.id}`, method: 'PATCH', |