Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function onSuccess(auth) {
const { token } = auth;
if (token == null) return;
setCookie({ token });
// TODO: Typed useRouter.
if (Router.query.redirectUrl) {
Router.replace(Router.query.redirectUrl);
} else if (props.redirectUrl) {
// $FlowFixMe Wrong libdef.
Router.replace(props.redirectUrl);
} else {
// $FlowFixMe Wrong libdef.
Router.replace({
pathname: Router.pathname,
query: Router.query,
});
}
}
useEffect(() => {
if (process.browser && Router.pathname.startsWith('/docs')) setIsDocs(true);
if (process.env.NODE_ENV !== 'test') {
import('docsearch.js').then(mdl => {
mdl.default({
apiKey: '79886fb59ad3ebe2002b481cffbbe7cb',
indexName: 'styled-components',
inputSelector: '[class^="Search__Input"]',
debug: true, // Set debug to true if you want to inspect the dropdown
handleSelected: (input, event, suggestion) => {
// original handleselect
requestModalClose();
input.setVal('');
window.location.assign(suggestion.url);
},
});
});
search = q => {
console.log(Router.query);
Router.push({
pathname: Router.pathname,
query: {...Router.query, ...{description: q}},
});
};
componentDidMount() {
if (!isPresent(this.state.searchState.query) && Router.pathname === '/search') {
const searchInput = window.document.querySelector('#global-product-search')
if (searchInput) searchInput.focus()
}
if (window.location.host !== 'glutenproject.com') {
this.setState({production: false})
}
}
moderators: company.Moderators.map(mod => {
return mod.userEmail;
}).join(', '),
industry: {
value: company.Industry,
label: company.Industry,
},
};
delete company['Skills'];
delete company['Perks'];
delete company['Moderators'];
let title = `ReactEurope Jobs - ${company.company.name}`;
let url;
req
? (url = publicRuntimeConfig.host + req.path)
: (url = publicRuntimeConfig.host + Router.pathname);
return {
translations,
company,
companyId,
userInfo,
lang,
companiesCount,
title,
url,
};
}
constructor(props) {
get location() {
if (this.isServer) {
return this.context.location
} else if (this.isClient) {
return {
pathname: Router.pathname,
query: Router.query,
raw: Router.asPath
}
}
}
id: jobId,
userId: userInfo.userId,
});
let companiesCount = job.Company_aggregate;
let title = 'ReactEurope Jobs - ';
if (job.Job.length > 0) {
job = job.Job[0];
title += job.JobTitle + ' at ' + job.Company.name;
} else {
job = null;
}
let url;
req
? (url = publicRuntimeConfig.host + req.path)
: (url = publicRuntimeConfig.host + Router.pathname);
return {
translations,
jobId,
userInfo,
job,
lang,
companiesCount,
title,
url,
};
}
constructor(props) {
componentDidMount() {
const pathname = Router.pathname.toLowerCase();
this.setState({ pathname });
}
redirectIfInvalid () {
if (this.isValid() === false) {
Router.push({
pathname: '/admin/login',
query: { 'from': Router.pathname}
})
return true
}
return false
}
onPageChange = (page, pageSize) => {
Router.push({
pathname: Router.pathname,
query: Object.assign({ ...Router.query }, {
offset: (page - 1) * pageSize,
}),
})
}