mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
Format file format from Windows/dos to Unix (#1949)
### What problem does this PR solve? Related source file is in Windows/DOS format, they are format to Unix format. ### Type of change - [x] Refactoring Signed-off-by: Jin Hai <haijin.chn@gmail.com>
This commit is contained in:
@ -1,27 +1,26 @@
|
||||
import React, { useReducer } from 'react'
|
||||
const CHANGE_LOCALE = 'CHANGE_LOCALE'
|
||||
|
||||
const mainContext = React.createContext()
|
||||
|
||||
const reducer = (state, action) => {
|
||||
switch (action.type) {
|
||||
case CHANGE_LOCALE:
|
||||
return { ...state, locale: action.locale || 'zh' }
|
||||
default:
|
||||
return state
|
||||
}
|
||||
}
|
||||
|
||||
const ContextProvider = (props) => {
|
||||
const [state, dispatch] = useReducer(reducer, {
|
||||
locale: 'zh'
|
||||
})
|
||||
return (
|
||||
<mainContext.Provider value={{ state, dispatch }}>
|
||||
{props.children}
|
||||
</mainContext.Provider>
|
||||
)
|
||||
}
|
||||
|
||||
export { reducer, mainContext, ContextProvider }
|
||||
|
||||
import React, { useReducer } from 'react';
|
||||
const CHANGE_LOCALE = 'CHANGE_LOCALE';
|
||||
|
||||
const mainContext = React.createContext();
|
||||
|
||||
const reducer = (state, action) => {
|
||||
switch (action.type) {
|
||||
case CHANGE_LOCALE:
|
||||
return { ...state, locale: action.locale || 'zh' };
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
const ContextProvider = (props) => {
|
||||
const [state, dispatch] = useReducer(reducer, {
|
||||
locale: 'zh',
|
||||
});
|
||||
return (
|
||||
<mainContext.Provider value={{ state, dispatch }}>
|
||||
{props.children}
|
||||
</mainContext.Provider>
|
||||
);
|
||||
};
|
||||
|
||||
export { ContextProvider, mainContext, reducer };
|
||||
|
||||
Reference in New Issue
Block a user