mirror of
https://github.com/AykutSarac/jsoncrack.com.git
synced 2025-01-12 19:02:53 +08:00
add set_content event
This commit is contained in:
parent
78c0949439
commit
a6e66aa02a
@ -1,4 +1,5 @@
|
||||
import debounce from "lodash.debounce";
|
||||
import { event as gaEvent } from "nextjs-google-analytics";
|
||||
import { toast } from "react-hot-toast";
|
||||
import { create } from "zustand";
|
||||
import { defaultJson } from "src/constants/data";
|
||||
@ -79,6 +80,7 @@ const useFile = create<FileStates & JsonActions>()((set, get) => ({
|
||||
setFile: fileData => {
|
||||
set({ fileData, format: fileData.format || FileFormat.JSON });
|
||||
get().setContents({ contents: fileData.content, hasChanges: false });
|
||||
gaEvent("set_content", { label: fileData.format });
|
||||
},
|
||||
getContents: () => get().contents,
|
||||
getFormat: () => get().format,
|
||||
|
Loading…
x
Reference in New Issue
Block a user