Skip to content

Commit 94038e9

Browse files
committed
fix auth
1 parent d534e2f commit 94038e9

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

components/AuthForm/AuthForm.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const AuthForm = ({ type }) => {
5757
label={t('label.email')}
5858
autocomplete={fieldTypes.email}
5959
name={fieldTypes.email}
60+
type="email"
6061
validate={[emailValidator]}
6162
/>
6263
)

components/Forms/SearchForm.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ const SearchFormComponent: React.FunctionComponent<Props> = ({
6767
const { t } = useTranslation()
6868
const onSubmit = (values: any) => {
6969
const query = toQueryBasic(values)
70-
71-
console.log('query', query)
7270
closeModal()
7371
if (query) {
7472
router.push({

components/Input/BaseInput.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ const BaseInput = forwardRef(
6565
small && styles.small
6666
)}
6767
value={value}
68-
autoComplete={autocomplete}
6968
{...inputProps}
69+
autoComplete={autocomplete}
7070
/>
7171
)
7272
return (
@@ -77,8 +77,8 @@ const BaseInput = forwardRef(
7777
small && styles.small
7878
)}
7979
value={value}
80-
autoComplete={autocomplete}
8180
{...inputProps}
81+
autoComplete={autocomplete}
8282
/>
8383
)
8484
}
@@ -112,7 +112,7 @@ BaseInput.defaultProps = {
112112
min: null,
113113
hasLabel: false,
114114
type: '',
115-
autocomplete: '',
115+
autocomplete: 'off',
116116
}
117117

118118
export default memo(BaseInput)

lib/FeathersClient.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,15 @@ class FeathersClient {
3232
service = (service) => this.app.service(service)
3333

3434
disconnect = async () => {
35+
console.log('Disconnecting...')
3536
if (process.browser) {
3637
window.localStorage.removeItem('feathers-jwt')
37-
await this.feathers.logout()
38+
await this.app.logout()
3839
}
3940
}
4041

4142
reAuthenticate = () => {
43+
console.log('Re-authenticating...')
4244
try {
4345
this.app.reAuthenticate()
4446
} catch (e) {
@@ -48,10 +50,13 @@ class FeathersClient {
4850
}
4951

5052
authenticate = async (config) => {
53+
console.log('Authenticating...')
5154
try {
5255
if (process.browser) {
53-
window.localStorage.setItem('feathers-jwt', accessToken)
54-
await this.app.authenticate(config)
56+
const response = await this.app.authenticate(config)
57+
if (response.accessToken)
58+
window.localStorage.setItem('feathers-jwt', response.accessToken)
59+
return response
5560
}
5661
} catch (e) {
5762
console.error('Authentication error', e)

pages/search/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ import {
1313
ListingsCarousel,
1414
InfinitePagination,
1515
Layout,
16+
Loader,
1617
} from '../../components'
1718
import {
1819
listingPaginationSelector,
1920
listingsSelector,
21+
listingsLoadingSelector,
2022
} from '../../store/listing/selectors'
2123
import Creators from '../../store/listing/creators'
2224
import styles from './search.module.scss'
@@ -61,6 +63,7 @@ const SearchPage: React.FunctionComponent = () => {
6163
const pagination = useSelector(listingPaginationSelector)
6264
const listings = useSelector(listingsSelector)
6365
const makes = useSelector(makesSelector)
66+
const loading = useSelector(listingsLoadingSelector)
6467
const count = get(pagination, 'total', 0)
6568

6669
const fetch = (resetPagination = false) => {
@@ -124,7 +127,8 @@ const SearchPage: React.FunctionComponent = () => {
124127
return (
125128
<Layout background="white" fullscreen className={styles.layout}>
126129
<div className={styles.search}>
127-
<h1>{`${t('titles.foundVehicles')}: ${count}`}</h1>
130+
{loading && <Loader loading />}
131+
{!loading && <h1>{`${t('titles.foundVehicles')}: ${count}`}</h1>}
128132
<SearchForm
129133
cb={() => fetch(true)}
130134
defaultExpanded={defaultExpanded}

0 commit comments

Comments
 (0)