-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5206dd3
commit 340bb3e
Showing
8 changed files
with
134 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Button } from '@/components/ui/button' | ||
import Image from 'next/image' | ||
import Link from 'next/link' | ||
import React from 'react' | ||
|
||
const TransactionSuccessful = () => { | ||
return ( | ||
<div className='flex flex-col h-screen items-center justify-center space-y-4'> | ||
<Image src="/icons/success.gif" alt='success gif' width={100} height={100} className="w-60" /> | ||
<h3 className="text-xl font-semibold">Shop created successfully!</h3> | ||
<Link href="/accounts"> | ||
<Button variant={"ghost"} size={"lg"} className='bg-secondary-green-60 hover:bg-secondary-green-50 rounded-full text-white hover:text-white'> | ||
Check status | ||
</Button> | ||
</Link> | ||
</div> | ||
) | ||
} | ||
|
||
export default TransactionSuccessful |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,36 @@ | ||
"use server" | ||
|
||
import { becomeVendorFormProps } from "@/types" | ||
import { cookies } from "next/headers" | ||
import { createSessionClient } from "./config" | ||
import { ID } from "node-appwrite" | ||
|
||
const { DATABASE_ID, VENDOR_ID } = process.env | ||
|
||
const createVendorAccount = async (data: becomeVendorFormProps) => { | ||
export const createVendorAccount = async (data: becomeVendorFormProps) => { | ||
const cookieStore = await cookies() | ||
try { | ||
const userId = cookieStore.get("userId")?.value | ||
const session = cookieStore.get("session")?.value | ||
|
||
const { databases } = await createSessionClient(session) | ||
|
||
const result = await databases.createDocument( | ||
DATABASE_ID!, | ||
VENDOR_ID!, | ||
ID.unique(), | ||
{ | ||
user: userId, | ||
...data | ||
} | ||
) | ||
|
||
await cookieStore.set("vendorId", result.$id) | ||
return result | ||
} catch (error) { | ||
if (error instanceof Error) { | ||
console.log(error.message); | ||
// console.log(error.message); | ||
console.log(error) | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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