Skip to content

Commit

Permalink
set up backend for shop account creation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ibidapo-Ayo committed Nov 8, 2024
1 parent 9ec488b commit 5206dd3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ NEXT_PUBLIC_AUTH_TOKEN="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjp7InVzZXJ
NEXT_PUBLIC_API_BASE_URL=https://www.universal-tutorial.com
NEXT_PUBLIC_PAYSTACK_TEST_API_KEY=pk_test_12a8875d58c10847ca4e7bf615c420b01e53b0ec
PAYSTACK_SECRET_KEY=sk_test_080e692d746b701ed7cfd89c6b03ab250eff92f4
TRANSACTION_COLLECTION=6723d0aa00145d84ce95
TRANSACTION_COLLECTION=6723d0aa00145d84ce95
VENDOR_ID=6729aebb002a31853e4b
15 changes: 15 additions & 0 deletions appwrite/vendor.actions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"use server"

import { becomeVendorFormProps } from "@/types"

const { DATABASE_ID, VENDOR_ID } = process.env

const createVendorAccount = async (data: becomeVendorFormProps) => {
try {

} catch (error) {
if (error instanceof Error) {
console.log(error.message);
}
}
}
2 changes: 1 addition & 1 deletion components/forms/BecomeVendorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ const PrevAndNextButton = ({ nextStep, next, prev }: {
}) => {
return (
<div className='flex justify-between items-center gap-10'>
<Button type="button" className='border-2 border-secondary-green-50 w-full text-secondary-green-60 hover:text-secondary-green-50 font-semibold hover:bg-transparent' variant={"outline"} size={"lg"} disabled={prev === ""} onClick={() => nextStep(prev)}>Prev</Button>
<Button type="button" className='border-2 border-secondary-green-50 w-full text-secondary-green-60 hover:text-secondary-green-50 font-semibold hover:bg-transparent disabled:cursor-not-allowed' variant={"outline"} size={"lg"} disabled={prev === ""} onClick={() => nextStep(prev)}>Prev</Button>
{next !== "submit" && (
<Button type="button" className='bg-secondary-green-60 hover:bg-secondary-green-50 w-full text-white hover:text-white font-semibold' variant={"ghost"} size={"lg"} onClick={() => nextStep(next)}>Next</Button>
)}
Expand Down
29 changes: 6 additions & 23 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,12 @@
import { becomeVendorFormSchema } from "@/constants/validations"
import { StaticImageData } from "next/image"
import { Models } from "node-appwrite"
import { z } from "zod"

export type PriceCardProps = {
price: number,
striked_price?: number
}

declare type ItemsCardProps = {
title: string,
price: number,
striked_price?: number,
image: string | undefined,
productType?: "organic" | "cold-sale",
inStock?: number,
availableItems?: number,
totalItems?: number,
path?: string,
className?: string,
cardClassName?: string,
rating?: number,
comments?: string,
offer?: {
percentage: number,
endTime: string
}
}

declare type ItemsProps = {
title: string,
image: StaticImageData,
Expand Down Expand Up @@ -56,7 +37,7 @@ declare interface UserInfoParams extends Models.Document {
image?: FormData | undefined,
phone_number?: string,
email?: string,
accountId?:string
accountId?: string
}
declare interface ProductsProps extends Omit<CreateProductParams, "image">, Models.Document, Document {
productImageUrl: string,
Expand Down Expand Up @@ -87,4 +68,6 @@ declare type Cart = {
declare type State = {
carts?: Cart[],
totalCarts?: number,
}
}

declare type becomeVendorFormProps = z.infer<typeof becomeVendorFormSchema>

0 comments on commit 5206dd3

Please sign in to comment.