mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
refactor(console,ui): import noop
from silverhand/essentials
(#2601)
This commit is contained in:
parent
dac1f5cb49
commit
29f2ce45d4
3 changed files with 3 additions and 12 deletions
|
@ -1,10 +1,7 @@
|
|||
import type { LanguageTag } from '@logto/language-kit';
|
||||
import { noop } from '@silverhand/essentials';
|
||||
import { createContext, useMemo, useState } from 'react';
|
||||
|
||||
const noop = () => {
|
||||
throw new Error('Context provider not found');
|
||||
};
|
||||
|
||||
export type ConfirmationState = 'none' | 'try-close' | 'try-switch-language' | 'try-add-language';
|
||||
|
||||
export type Context = {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import type { Nullable } from '@silverhand/essentials';
|
||||
import { noop } from '@silverhand/essentials';
|
||||
import { useState, useRef, useMemo, createContext, useCallback } from 'react';
|
||||
|
||||
import type { ModalProps } from '@/components/ConfirmModal';
|
||||
|
@ -25,10 +26,6 @@ type ConfirmModalContextType = {
|
|||
cancel: (data?: unknown) => void;
|
||||
};
|
||||
|
||||
const noop = () => {
|
||||
throw new Error('Context provider not found');
|
||||
};
|
||||
|
||||
export const ConfirmModalContext = createContext<ConfirmModalContextType>({
|
||||
show: async () => [true],
|
||||
confirm: noop,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { noop } from '@silverhand/essentials';
|
||||
import { useState, useMemo, createContext } from 'react';
|
||||
import { isMobile } from 'react-device-detect';
|
||||
|
||||
|
@ -18,10 +19,6 @@ export type Context = {
|
|||
setExperienceSettings: React.Dispatch<React.SetStateAction<SignInExperienceResponse | undefined>>;
|
||||
};
|
||||
|
||||
const noop = () => {
|
||||
throw new Error('Context provider not found');
|
||||
};
|
||||
|
||||
export const PageContext = createContext<Context>({
|
||||
toast: '',
|
||||
theme: 'light',
|
||||
|
|
Loading…
Reference in a new issue