Skip to content

Commit 836a4e2

Browse files
author
Jovert Lota Palonpon
committed
[Module Bundling] Improved imports of utils
1 parent 695cb7d commit 836a4e2

File tree

9 files changed

+42
-63
lines changed

9 files changed

+42
-63
lines changed

public/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"js/backoffice.js": "js/backoffice.bundle.0d984d671fd00bfd1a94.js",
2+
"js/backoffice.js": "js/backoffice.bundle.d1d987f51245810acc04.js",
33
"js/vendor.js": "js/vendor.bundle.60bab7ed0c4b898e6cd4.js"
44
}

public/js/backoffice.bundle.0d984d671fd00bfd1a94.js renamed to public/js/backoffice.bundle.d1d987f51245810acc04.js

Lines changed: 7 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

resources/js/Backoffice.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import { withWidth, CssBaseline, MuiThemeProvider } from '@material-ui/core';
44

55
import { Navigator } from './core';
66
import { ROUTES } from './config';
7-
import { _route } from './utils/Navigation';
8-
import { _queryString } from './utils/URL';
97
import { backofficeTheme as theme } from './themes';
108
import { Loading } from './views';
119

resources/js/core/Navigator.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { withRouter, Route, Switch, Redirect } from 'react-router-dom';
44

5-
import { _route } from '../utils/Navigation';
6-
import { _queryString } from '../utils/URL';
5+
import * as NavigationUtils from '../utils/Navigation';
6+
import * as UrlUtils from '../utils/URL';
77

88
const Navigator = props => {
99
const { authenticated, username, environment, routes } = props.pageProps;
@@ -24,10 +24,12 @@ const Navigator = props => {
2424
return (
2525
<Redirect
2626
to={{
27-
search: _queryString({
27+
search: UrlUtils._queryString({
2828
username,
2929
}),
30-
pathname: _route('auth.signin'),
30+
pathname: NavigationUtils._route(
31+
'auth.signin',
32+
),
3133
}}
3234
/>
3335
);
@@ -38,7 +40,9 @@ const Navigator = props => {
3840
if (authenticated) {
3941
return (
4042
<Redirect
41-
to={_route(`${environment}.home`)}
43+
to={NavigationUtils._route(
44+
`${environment}.home`,
45+
)}
4246
/>
4347
);
4448
}

resources/js/ui/TableToolbar/TableToolbar.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import {
2626

2727
import { FilterList as FilterListIcon } from '@material-ui/icons';
2828

29-
import { _uppercaseFirst } from '../../utils/String';
3029
import FilterForm from './Forms/Filter';
3130

3231
class TableToolbar extends Component {

resources/js/utils/Navigation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ROUTES } from '../config';
2-
import { _queryString } from '../utils/URL';
2+
import * as UrlUtils from '../utils/URL';
33

44
/**
55
* Find the route by its name.
@@ -31,7 +31,7 @@ export function _route(name, segmentParams = {}, queryParams = {}) {
3131

3232
// We will append a query string if there are query parameters provided.
3333
if (segmentParams && Object.values(segmentParams).length > 0) {
34-
routePath = `${routePath}${_queryString(queryParams)}`;
34+
routePath = `${routePath}${UrlUtils._queryString(queryParams)}`;
3535
}
3636

3737
return routePath;

resources/js/views/__backoffice/users/List.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { IconButton, Tooltip } from '@material-ui/core';
44

55
import { Delete as DeleteIcon, Edit as EditIcon } from '@material-ui/icons';
66

7-
import { _route } from '../../../utils/Navigation';
8-
import { _color } from '../../../utils/Random';
9-
import { _queryParams, _queryString } from '../../../utils/URL';
7+
import * as UrlUtils from '../../../utils/URL';
108
import { Table } from '../../../ui';
119
import { Master as MasterLayout } from '../layouts';
1210
import { User } from '../../../models';
@@ -148,7 +146,7 @@ class List extends Component {
148146
const { current_page: page, per_page: perPage } = pagination;
149147
const { by: sortBy, type: sortType } = sorting;
150148

151-
const queryString = _queryString({
149+
const queryString = UrlUtils._queryString({
152150
page,
153151
perPage,
154152
sortBy,
@@ -208,7 +206,7 @@ class List extends Component {
208206
async componentDidMount() {
209207
const { location } = this.props;
210208
const queryParams = (location, 'search')
211-
? _queryParams(location.search)
209+
? UrlUtils._queryParams(location.search)
212210
: {};
213211

214212
const filters = {};

resources/js/views/auth/SignIn.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import {
2121
VisibilityOff as VisibilityOffIcon,
2222
} from '@material-ui/icons';
2323

24-
import { _queryParams, _queryString } from '../../utils/URL';
25-
import { _route } from '../../utils/Navigation';
24+
import * as UrlUtils from '../../utils/URL';
25+
import * as NavigationUtils from '../../utils/Navigation';
2626
import { Auth as AuthLayout } from '../layouts';
2727

2828
class SignIn extends Component {
@@ -84,7 +84,7 @@ class SignIn extends Component {
8484
username: response.data,
8585
});
8686

87-
const queryString = _queryString({
87+
const queryString = UrlUtils._queryString({
8888
username: response.data,
8989
});
9090

@@ -184,7 +184,7 @@ class SignIn extends Component {
184184
async componentDidMount() {
185185
const { location } = this.props;
186186

187-
const queryParams = _queryParams(location.search);
187+
const queryParams = UrlUtils._queryParams(location.search);
188188

189189
if (
190190
queryParams.hasOwnProperty('username') &&
@@ -349,12 +349,12 @@ class SignIn extends Component {
349349
<RouterLink
350350
{...props}
351351
to={{
352-
search: _queryString(
352+
search: UrlUtils._queryString(
353353
{
354354
username,
355355
},
356356
),
357-
pathname: _route(
357+
pathname: NavigationUtils._route(
358358
'auth.passwords.request',
359359
),
360360
}}

resources/js/views/auth/passwords/Request.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import * as Yup from 'yup';
55
import { Grid, TextField, Button, Link, withStyles } from '@material-ui/core';
66

77
import { Auth as AuthLayout } from '../../layouts';
8-
import { _route } from '../../../utils/Navigation';
9-
import { _queryParams, _queryString } from '../../../utils/URL';
8+
import * as NavigationUtils from '../../../utils/Navigation';
9+
import * as UrlUtils from '../../../utils/URL';
1010

1111
class PasswordRequest extends Component {
1212
state = {
@@ -30,7 +30,7 @@ class PasswordRequest extends Component {
3030

3131
const { history } = this.props;
3232
const { email } = values;
33-
const routeSuffix = _route('auth.passwords.reset');
33+
const routeSuffix = NavigationUtils._route('auth.passwords.reset');
3434

3535
const response = await axios.post('api/auth/password/request', {
3636
email,
@@ -86,8 +86,10 @@ class PasswordRequest extends Component {
8686
const { location } = this.props;
8787

8888
this.setState({
89-
email: _queryParams(location.search).hasOwnProperty('username')
90-
? _queryParams(location.search).username
89+
email: UrlUtils._queryParams(location.search).hasOwnProperty(
90+
'username',
91+
)
92+
? UrlUtils._queryParams(location.search).username
9193
: '',
9294
});
9395
}
@@ -107,7 +109,7 @@ class PasswordRequest extends Component {
107109
<Formik
108110
initialValues={{
109111
email: !email
110-
? _queryParams(location.search).username
112+
? UrlUtils._queryParams(location.search).username
111113
: email,
112114
}}
113115
onSubmit={this.handleRequestPasswordSubmit}
@@ -154,10 +156,12 @@ class PasswordRequest extends Component {
154156
<RouterLink
155157
{...props}
156158
to={{
157-
search: _queryString({
158-
username: email,
159-
}),
160-
pathname: _route(
159+
search: UrlUtils._queryString(
160+
{
161+
username: email,
162+
},
163+
),
164+
pathname: NavigationUtils._route(
161165
'auth.signin',
162166
),
163167
}}

0 commit comments

Comments
 (0)