0
Fork 0
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:
Xiao Yijun 2022-12-07 11:29:03 +08:00 committed by GitHub
parent dac1f5cb49
commit 29f2ce45d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 12 deletions

View file

@ -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 = {

View file

@ -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,

View file

@ -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',