-
Notifications
You must be signed in to change notification settings - Fork 2
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
b0ecddb
commit 38e67e4
Showing
9 changed files
with
197 additions
and
34 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
'use client'; | ||
|
||
import { gql, useQuery } from 'urql'; | ||
|
||
const CART_QUERY = gql` | ||
query Cart($id: ID!) { | ||
cart(id: $id) { | ||
id | ||
} | ||
} | ||
`; | ||
|
||
const CartPage = () => { | ||
const [{ data, fetching, error }] = useQuery({ query: CART_QUERY }); | ||
|
||
return <div>Cart</div>; | ||
}; | ||
|
||
export default CartPage; |
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,45 @@ | ||
'use client'; | ||
|
||
import { gql, useQuery } from 'urql'; | ||
import { useParams } from 'next/navigation'; | ||
import Link from 'next/link'; | ||
|
||
const ORDER_QUERY = gql` | ||
query Order($id: ID!) { | ||
order(id: $id) { | ||
id | ||
storeId | ||
products { | ||
orderId | ||
productId | ||
product { | ||
id | ||
name | ||
unitPrice | ||
quantity | ||
images { | ||
id | ||
path | ||
} | ||
} | ||
} | ||
} | ||
} | ||
`; | ||
|
||
const OrderPage = () => { | ||
const { id } = useParams<{ id: string }>(); | ||
const [{ data, fetching, error }] = useQuery({ | ||
query: ORDER_QUERY, | ||
variables: { id } | ||
}); | ||
|
||
return ( | ||
<div> | ||
<Link href={`/store/${data?.order.storeId}`}>View store</Link> | ||
<pre>{JSON.stringify(data, null, 2)}</pre> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OrderPage; |
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,48 @@ | ||
'use client'; | ||
|
||
import { gql, useQuery } from 'urql'; | ||
|
||
const ORDERS_QUERY = gql` | ||
query Orders { | ||
currentUser { | ||
id | ||
orders { | ||
id | ||
store { | ||
id | ||
name | ||
image { | ||
id | ||
path | ||
} | ||
} | ||
products { | ||
orderId | ||
productId | ||
product { | ||
id | ||
name | ||
} | ||
unitPrice | ||
quantity | ||
} | ||
total | ||
status | ||
createdAt | ||
} | ||
} | ||
} | ||
`; | ||
|
||
const OrdersPage = () => { | ||
const [{ data, fetching, error }] = useQuery({ query: ORDERS_QUERY }); | ||
|
||
return ( | ||
<div> | ||
<h1>Orders</h1> | ||
<pre>{JSON.stringify(data, null, 2)}</pre> | ||
</div> | ||
); | ||
}; | ||
|
||
export default OrdersPage; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ const items = [ | |
icon: ShoppingBag | ||
}, | ||
{ | ||
href: '/cart', | ||
href: '/carts', | ||
icon: ShoppingCart | ||
} | ||
]; | ||
|