Skip to content

Commit 4698df2

Browse files
author
Jovert Lota Palonpon
committed
wip
1 parent 530fca6 commit 4698df2

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

app/Http/Controllers/Api/UsersController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function store(Request $request) : JsonResponse
4141
'nullable|date:Y-m-d|before:'.now()->subYear(10)->format('Y-m-d'),
4242
'address' => 'nullable|string|max:510',
4343

44-
'email' => 'required|email|unique:users',
44+
'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL',
4545
'username' => 'nullable|unique:users'
4646
]);
4747

resources/js/ui/Snackbar.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,32 @@ const Snackbar = props => {
3939
} = props;
4040
const Icon = icons[type];
4141

42+
let primaryAction = null;
43+
44+
if (action && actionText) {
45+
primaryAction = (
46+
<Button key="undo" color="inherit" size="small" onClick={action}>
47+
{actionText}
48+
</Button>
49+
);
50+
}
51+
52+
let actions = [
53+
<IconButton
54+
key="close"
55+
aria-label="Close"
56+
color="inherit"
57+
className={classes.close}
58+
onClick={closed}
59+
>
60+
<CloseIcon className={classes.icon} />
61+
</IconButton>,
62+
];
63+
64+
if (primaryAction) {
65+
actions.push(primaryAction);
66+
}
67+
4268
return (
4369
<MuiSnackbar
4470
anchorOrigin={{
@@ -63,26 +89,7 @@ const Snackbar = props => {
6389
{body}
6490
</span>
6591
}
66-
action={[
67-
<Button
68-
key="undo"
69-
color="inherit"
70-
size="small"
71-
onClick={action}
72-
>
73-
{actionText}
74-
</Button>,
75-
76-
<IconButton
77-
key="close"
78-
aria-label="Close"
79-
color="inherit"
80-
className={classes.close}
81-
onClick={closed}
82-
>
83-
<CloseIcon className={classes.icon} />
84-
</IconButton>,
85-
]}
92+
action={actions.reverse()}
8693
{...other}
8794
/>
8895
</MuiSnackbar>

0 commit comments

Comments
 (0)