Upgraded to next v15 and eslint to v9
This commit is contained in:
@ -5,20 +5,20 @@ import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
import { useRegion } from './region';
|
||||
|
||||
type CartContextType = {
|
||||
interface CartContextType {
|
||||
cart?: HttpTypes.StoreCart;
|
||||
setCart: React.Dispatch<React.SetStateAction<HttpTypes.StoreCart | undefined>>;
|
||||
addToCart: (variant_id: string, quantity: number) => void;
|
||||
updateQuantity: (item_id: string, quantity: number) => void;
|
||||
removeItem: (item_id: string) => void;
|
||||
refreshCart: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
const CartContext = createContext<CartContextType | null>(null);
|
||||
|
||||
type CartProviderProps = {
|
||||
interface CartProviderProps {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
}
|
||||
|
||||
export const CartProvider = ({ children }: CartProviderProps) => {
|
||||
const [cart, setCart] = useState<HttpTypes.StoreCart>();
|
||||
@ -68,7 +68,7 @@ export const CartProvider = ({ children }: CartProviderProps) => {
|
||||
setCart(undefined);
|
||||
};
|
||||
|
||||
function addToCart(variant_id: string, quantity: number = 1) {
|
||||
function addToCart(variant_id: string, quantity = 1) {
|
||||
if (!cart) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3,18 +3,18 @@
|
||||
import { HttpTypes } from '@medusajs/types';
|
||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
type CustomerContextType = {
|
||||
interface CustomerContextType {
|
||||
customer: HttpTypes.StoreCustomer | undefined;
|
||||
register: (firstName: string, lastName: string, email: string, password: string) => Promise<void>;
|
||||
login: (email: string, password: string) => Promise<void>;
|
||||
logout: () => void;
|
||||
};
|
||||
}
|
||||
|
||||
const CustomerContext = createContext<CustomerContextType | null>(null);
|
||||
|
||||
type CustomerProviderProps = {
|
||||
interface CustomerProviderProps {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
}
|
||||
|
||||
export const CustomerProvider = ({ children }: CustomerProviderProps) => {
|
||||
const [customer, setCustomer] = useState<HttpTypes.StoreCustomer | undefined>();
|
||||
|
||||
@ -3,16 +3,16 @@
|
||||
import { HttpTypes } from '@medusajs/types';
|
||||
import React, { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
type RegionContextType = {
|
||||
interface RegionContextType {
|
||||
region?: HttpTypes.StoreRegion;
|
||||
setRegion: React.Dispatch<React.SetStateAction<HttpTypes.StoreRegion | undefined>>;
|
||||
};
|
||||
}
|
||||
|
||||
const RegionContext = createContext<RegionContextType | null>(null);
|
||||
|
||||
type RegionProviderProps = {
|
||||
interface RegionProviderProps {
|
||||
children: React.ReactNode;
|
||||
};
|
||||
}
|
||||
|
||||
export const RegionProvider = ({ children }: RegionProviderProps) => {
|
||||
const [region, setRegion] = useState<HttpTypes.StoreRegion>();
|
||||
|
||||
Reference in New Issue
Block a user