mirror of
https://github.com/notion-enhancer/notion-enhancer.git
synced 2025-04-11 15:59:03 +00:00
fix(menu): preserve profile name on import, enabled repeat imports of same file
This commit is contained in:
parent
50a23f17c5
commit
f943697ba7
@ -58,9 +58,11 @@ function Profile({ id }) {
|
|||||||
const file = event.target.files[0],
|
const file = event.target.files[0],
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
reader.onload = async (progress) => {
|
reader.onload = async (progress) => {
|
||||||
const res = progress.currentTarget.result;
|
|
||||||
try {
|
try {
|
||||||
await profile.import(JSON.parse(res));
|
let res = progress.currentTarget.result;
|
||||||
|
res = JSON.parse(res);
|
||||||
|
delete res["profileName"];
|
||||||
|
await profile.import(res);
|
||||||
setState({ rerender: true, databaseUpdated: true });
|
setState({ rerender: true, databaseUpdated: true });
|
||||||
$uploadSuccess.show();
|
$uploadSuccess.show();
|
||||||
setTimeout(() => $uploadSuccess.hide(), 2000);
|
setTimeout(() => $uploadSuccess.hide(), 2000);
|
||||||
@ -68,6 +70,8 @@ function Profile({ id }) {
|
|||||||
$uploadError.show();
|
$uploadError.show();
|
||||||
setTimeout(() => $uploadError.hide(), 2000);
|
setTimeout(() => $uploadError.hide(), 2000);
|
||||||
}
|
}
|
||||||
|
// clear input value to allow repeat uploads
|
||||||
|
event.target.value = "";
|
||||||
};
|
};
|
||||||
reader.readAsText(file);
|
reader.readAsText(file);
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user