Skip to content

Commit

Permalink
Refactor order status service
Browse files Browse the repository at this point in the history
  • Loading branch information
gvdongen committed Jan 22, 2024
1 parent b24b7d2 commit 01ef5b8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import * as restate from "@restatedev/restate-sdk";

const ORDER_STATUS = "order_status";

const get = async (ctx: restate.RpcContext, orderId: string) =>
/** Gets called by the webUI frontend to display the status of an order. */
const get = async (ctx: restate.RpcContext, _orderId: string) =>
ctx.get<OrderStatus>(ORDER_STATUS);

const setStatus = async (
Expand Down Expand Up @@ -48,5 +49,5 @@ export const router = restate.keyedRouter({
});
export type orderStatusApi = typeof router;
export const service: restate.ServiceApi<orderStatusApi> = {
path: "orderStatus",
path: "order-status",
};
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const Cart = () => {
let done = false;
while (!done) {
const newOrderStatus = (
await sendRequestToRestate('orderStatus', 'get', {
await sendRequestToRestate('order-status', 'get', {
key: user!.user_id,
})
).response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const useOrderStatus = () => {
const fetchOrderStatus = useCallback(() => {
if (user) {
console.debug(`Found user ${user}`);
sendRequestToRestate('orderStatus', 'get', {
sendRequestToRestate('order-status', 'get', {
key: user!.shopping_cart_id,
}).then((response) => {
setOrderStatus(response.response);
Expand Down

0 comments on commit 01ef5b8

Please sign in to comment.