From 2b3d32a641da19c9d807f1877efcbe1a130c5e23 Mon Sep 17 00:00:00 2001 From: Michael Hunteman Date: Fri, 1 Mar 2024 07:44:28 -0800 Subject: Use guest for login and RSVP update --- src/apiSlice.ts | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'src/apiSlice.ts') diff --git a/src/apiSlice.ts b/src/apiSlice.ts index ab46822..808806f 100644 --- a/src/apiSlice.ts +++ b/src/apiSlice.ts @@ -1,29 +1,25 @@ import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react'; import { RootState } from './store' -export interface User { +export interface LoginRequest { firstName: string lastName: string - id: number } -export interface UserResponse { - user: User +export interface LoginResponse { + guest: Guest token: string } -export interface LoginRequest { - firstName: string - lastName: string -} - export interface Guest { id: number + firstName: string + lastName: string attendance: string - mealPreference: string - dietaryRestrictions: string + meal: string + restrictions: string plusOne: string - marriageAdvice: string + advice: string } export const apiSlice = createApi({ @@ -46,13 +42,13 @@ export const apiSlice = createApi({ }), updateGuest: builder.mutation({ query: guest => ({ - url: `/guests/${guest.id}`, + url: `/guests/${guest?.id}`, method: 'PATCH', body: guest, providesTags: ['Guests'] }) }), - login: builder.mutation({ + login: builder.mutation({ query: credentials => ({ url: '/guest-login', method: 'POST', -- cgit v1.2.3