-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: md handle add upload image setting
- Loading branch information
Showing
15 changed files
with
253 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { getStorage, setStorage } from '@/utils'; | ||
|
||
import { create } from 'zustand'; | ||
|
||
export interface UploadInfo { | ||
url: string; | ||
field: string; | ||
navigation: string; | ||
body: string; | ||
} | ||
|
||
export interface MDState { | ||
uploadInfo: UploadInfo; | ||
} | ||
|
||
export interface MDActions { | ||
setUploadInfo(uploadInfo: UploadInfo): void; | ||
} | ||
|
||
export const useMDStore = create<MDState & MDActions>((set) => ({ | ||
...getStorage<MDState>('filesystem/md', { | ||
uploadInfo: { | ||
url: '', | ||
field: '', | ||
navigation: '', | ||
body: '' | ||
} | ||
}), | ||
setUploadInfo(uploadInfo) { | ||
set(() => { | ||
const store = { uploadInfo }; | ||
|
||
setStorage('filesystem/md', store); | ||
|
||
return store; | ||
}); | ||
} | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const toFormData = ( | ||
params: Record<string, string | Blob>, | ||
data?: FormData | ||
) => { | ||
data = data || new FormData(); | ||
|
||
const strategy: Record<string, () => string | Blob> = { | ||
$timestamp() { | ||
return Date.now().toString(); | ||
} | ||
}; | ||
|
||
for (const key in params) { | ||
data.append(key, strategy[params[key].toString()]?.() || params[key]); | ||
} | ||
|
||
return data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { default as useResizeObserver } from './useResizeObserver'; | ||
export * from './useResizeObserver'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
interface ILoadignProps {} | ||
interface ILoadingProps {} | ||
|
||
const Loadign: React.FC<Readonly<ILoadignProps>> = (props) => { | ||
const Loading: React.FC<Readonly<ILoadingProps>> = (props) => { | ||
console.log(props); | ||
|
||
return <div>Loadign</div>; | ||
return <div>Loading</div>; | ||
}; | ||
|
||
export default Loadign; | ||
export default Loading; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.