Chore: Fix eslint errors

This commit is contained in:
Gustav Hansen 2023-05-16 10:57:07 +02:00
parent 65a8d1965e
commit e210edbb38
11 changed files with 19 additions and 15 deletions

View File

@ -62,7 +62,7 @@ const Register = ({ authType, fieldsToDisable, noSignin, onSubmit, schema }) =>
const {
data: { data },
} = await axios.get(
`${strapi.backendURL}/admin/registration-info?registrationToken=${registrationToken}`
`${window.strapi.backendURL}/admin/registration-info?registrationToken=${registrationToken}`
);
if (data) {

View File

@ -87,7 +87,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
try {
await axios({
method: 'POST',
url: `${strapi.backendURL}${requestURL}`,
url: `${window.strapi.backendURL}${requestURL}`,
data: body,
cancelToken: source.token,
});
@ -110,7 +110,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
},
} = await axios({
method: 'POST',
url: `${strapi.backendURL}${requestURL}`,
url: `${window.strapi.backendURL}${requestURL}`,
data: omit(body, fieldsToOmit),
cancelToken: source.token,
});
@ -158,7 +158,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
},
} = await axios({
method: 'POST',
url: `${strapi.backendURL}${requestURL}`,
url: `${window.strapi.backendURL}${requestURL}`,
data: omit(body, fieldsToOmit),
cancelToken: source.token,
});
@ -214,7 +214,7 @@ const AuthPage = ({ hasAdmin, setHasAdmin }) => {
},
} = await axios({
method: 'POST',
url: `${strapi.backendURL}${requestURL}`,
url: `${window.strapi.backendURL}${requestURL}`,
data: { ...body, resetPasswordToken: query.get('code') },
cancelToken: source.token,
});

View File

@ -13,7 +13,7 @@ const DividerFull = styled(Divider)`
`;
const Login = (loginProps) => {
const ssoEnabled = strapi.features.isEnabled(strapi.features.SSO);
const ssoEnabled = window.strapi.features.isEnabled(window.strapi.features.SSO);
const { isLoading, data: providers } = useAuthProviders({ ssoEnabled });
const { formatMessage } = useIntl();

View File

@ -35,7 +35,7 @@ const SSOProvidersWrapper = styled(Flex)`
const SSOProviderButton = ({ provider }) => {
return (
<Tooltip label={provider.displayName}>
<SSOButton href={`${strapi.backendURL}/admin/connect/${provider.uid}`}>
<SSOButton href={`${window.strapi.backendURL}/admin/connect/${provider.uid}`}>
{provider.icon ? (
<img src={provider.icon} aria-hidden alt="" height="32px" />
) : (

View File

@ -17,7 +17,7 @@ const DividerFull = styled(Divider)`
`;
const Providers = () => {
const ssoEnabled = strapi.features.isEnabled(strapi.features.SSO);
const ssoEnabled = window.strapi.features.isEnabled(window.strapi.features.SSO);
const { push } = useHistory();
const { formatMessage } = useIntl();

View File

@ -1,6 +1,6 @@
import baseModel from '../../../../../../../../../admin/src/pages/SettingsPage/pages/Users/ListPage/ModalForm/utils/formDataModel';
const ssoInputsModel = strapi.features.isEnabled(strapi.features.SSO)
const ssoInputsModel = window.strapi.features.isEnabled(window.strapi.features.SSO)
? {
useSSORegistration: true,
}

View File

@ -1,4 +1,4 @@
const form = strapi.features.isEnabled(strapi.features.SSO)
const form = window.strapi.features.isEnabled(window.strapi.features.SSO)
? [
[
{

View File

@ -10,7 +10,7 @@ const SERVER_HAS_BEEN_KILLED_MESSAGE = 'server is down';
*/
export default function serverRestartWatcher(response, didShutDownServer) {
return new Promise((resolve) => {
fetch(`${strapi.backendURL}/_health`, {
fetch(`${window.strapi.backendURL}/_health`, {
method: 'HEAD',
mode: 'no-cors',
headers: {

View File

@ -1,14 +1,14 @@
const openWithNewTab = (path) => {
const url = (() => {
if (path.startsWith('/')) {
return `${strapi.backendURL}${path}`;
return `${window.strapi.backendURL}${path}`;
}
if (path.startsWith('http')) {
return path;
}
return `${strapi.backendURL}/${path}`;
return `${window.strapi.backendURL}/${path}`;
})();
window.open(url, '_blank');

View File

@ -23,7 +23,9 @@ const Input = ({
}) => {
const { formatMessage } = useIntl();
const inputValue =
name === 'noName' ? `${strapi.backendURL}/api/connect/${providerToEditName}/callback` : value;
name === 'noName'
? `${window.strapi.backendURL}/api/connect/${providerToEditName}/callback`
: value;
const label = formatMessage(
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },

View File

@ -184,7 +184,9 @@ describe('<Input />', () => {
it('should set the value correctly when the input\'s name is "noName"', () => {
const { getByLabelText } = render(makeApp('noName', 'text', 'test'));
expect(getByLabelText('noName').value).toBe(`${strapi.backendURL}/api/connect/email/callback`);
expect(getByLabelText('noName').value).toBe(
`${window.strapi.backendURL}/api/connect/email/callback`
);
});
it('should display the toggleCheckbox correctly', () => {