fix: close the options window after clicking save
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
import { Toast } from 'bootstrap';
|
||||
import classNames from 'classnames';
|
||||
import React, { useEffect, useRef, useState } from 'react';
|
||||
import config, { SuccessOrFailType } from '../config/config';
|
||||
import apiKeyInvalid from '../utils/apiKey';
|
||||
@@ -38,8 +36,6 @@ export default function Options(): JSX.Element {
|
||||
whitelist: '',
|
||||
});
|
||||
|
||||
const liveToastRef = useRef(null);
|
||||
|
||||
const loggingStyleRef = useRef(null);
|
||||
|
||||
const restoreSettings = async (): Promise<void> => {
|
||||
@@ -131,9 +127,8 @@ export default function Options(): JSX.Element {
|
||||
trackSocialMedia,
|
||||
whitelist,
|
||||
});
|
||||
// eslint-disable-next-line
|
||||
Toast.getOrCreateInstance(liveToastRef?.current ?? '')?.show();
|
||||
await logUserIn(state.apiKey);
|
||||
window.close();
|
||||
};
|
||||
|
||||
const updateBlacklistState = (sites: string) => {
|
||||
@@ -363,30 +358,6 @@ export default function Options(): JSX.Element {
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="toast-container position-fixed bottom-0 end-0 p-3">
|
||||
<div
|
||||
className={classNames(
|
||||
'toast align-items-center justify-content-between alert',
|
||||
`alert-${state.alertType}`,
|
||||
)}
|
||||
role="alert"
|
||||
aria-live="assertive"
|
||||
aria-atomic="true"
|
||||
id="liveToast"
|
||||
ref={liveToastRef}
|
||||
data-bs-delay="3000"
|
||||
>
|
||||
<div className="fs-5">{state.alertText}</div>
|
||||
<div data-bs-theme="dark">
|
||||
<button
|
||||
type="button"
|
||||
className="btn-close m-0"
|
||||
data-bs-dismiss="toast"
|
||||
aria-label="Close"
|
||||
></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user