This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Front | DataModel | Logic] ShopCart Confirm (#42)
* setCmt * Toaster * INew * use500Toast * use500Toast * Confirm * update * 1
- Loading branch information
Showing
8 changed files
with
129 additions
and
22 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,23 @@ | ||
import { Toast, ToastBody, ToastTitle, useToastController } from "@fluentui/react-components"; | ||
|
||
/** | ||
* @author Aloento | ||
* @since 0.5.0 | ||
* @version 0.1.0 | ||
*/ | ||
export function use500Toast() { | ||
const { dispatchToast } = useToastController(); | ||
|
||
return (e: Error) => { | ||
dispatchToast( | ||
<Toast> | ||
<ToastTitle>Internal Error</ToastTitle> | ||
<ToastBody subtitle="More Info, See Console">{e.message || `${e}`}</ToastBody> | ||
</Toast>, | ||
{ intent: "error" } | ||
); | ||
|
||
console.error(e.cause); | ||
throw e; | ||
}; | ||
} |
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,28 @@ | ||
import { random } from "lodash-es"; | ||
import { ICartItem } from "~/Components/ShopCart"; | ||
|
||
/** | ||
* @author Aloento | ||
* @since 0.5.0 | ||
* @version 0.1.0 | ||
*/ | ||
interface INew { | ||
ShopCart: ICartItem[]; | ||
Comment?: string; | ||
} | ||
|
||
/** | ||
* @author Aloento | ||
* @since 0.5.0 | ||
* @version 0.1.0 | ||
*/ | ||
export class OrderPost { | ||
/** | ||
* @author Aloento | ||
* @since 0.5.0 | ||
* @version 0.1.0 | ||
*/ | ||
public static async New(req: INew): Promise<number> { | ||
return random(1, 100); | ||
} | ||
} |
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,10 @@ | ||
import { OrderPost } from "./Post"; | ||
|
||
/** | ||
* @author Aloento | ||
* @since 0.5.0 | ||
* @version 0.1.0 | ||
*/ | ||
export const Order = { | ||
Post: OrderPost | ||
} |
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