This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { create } from "zustand"; | |
import { createJSONStorage, persist } from "zustand/middleware"; | |
type UseProducerGlobalType = { | |
producerId: string | null; | |
setProducer: (producer: string) => void; | |
clearProducer: () => void; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { env } from "@/env" | |
export function api(path: string, init?: RequestInit) { | |
const token = localStorage.getItem('token') | |
const baseUrl = env.NEXT_PUBLIC_API_BASE_URL | |
const apiPrefix = '' | |
const url = new URL(apiPrefix.concat(path), baseUrl) | |
// Criar configuração com headers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface Coordinate { | |
latitude: number | |
longitude: number | |
} | |
export function getDistanceBetweenCoordinates( | |
from: Coordinate, | |
to: Coordinate, | |
) { | |
if (from.latitude === to.latitude && from.longitude === to.longitude) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export async function generateMetadata({ | |
params, | |
}: ProductProps): Promise<Metadata> { | |
return { | |
title: params.slug, | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Suspense } from 'react' | |
import { headers } from 'next/headers' | |
function IP() { | |
const FALLBACK_IP_ADDRESS = '0.0.0.0' | |
const forwardedFor = headers().get('x-forwarded-for') | |
if (forwardedFor) { | |
return forwardedFor.split(',')[0] ?? FALLBACK_IP_ADDRESS | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { forwardRef, InputHTMLAttributes, LegacyRef } from 'react' | |
import { FieldError } from 'react-hook-form' | |
import { Container, ErrorMessage, Input } from './style' | |
interface InputFormProps extends InputHTMLAttributes<HTMLInputElement> { | |
error?: FieldError | |
} | |
export const InputForm = forwardRef(function InputForm( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{Array.from({ length: 4 }).map((_, i) => ( | |
<div key={i} >{i}</div> | |
))} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { userStore } from '../../store/userStore' | |
export default function Home() { | |
async function handleUser(form: FormData) { | |
'use server' | |
const email = form.get('name') as string | |
if (!email) { | |
return |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ReactNode, createContext, useContext } from 'react' | |
interface CartContextType {} | |
const CartContext = createContext({} as CartContextType) | |
export function CartProvider({ children }: { children: ReactNode }) { | |
return <CartContext.Provider value={{}}>{children}</CartContext.Provider> | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
services: | |
# db mysql | |
db: | |
container_name: DB- | |
image: bitnami/mysql:latest | |
restart: always | |
environment: | |
MYSQL_ROOT_PASSWORD: 12345 | |
ports: | |
- "3306:3306" |
NewerOlder