Bugfixes
This commit is contained in:
parent
8e49139cb6
commit
33f163cd87
2 changed files with 5 additions and 5 deletions
|
@ -124,8 +124,8 @@ const savePost = (saveArchive?: boolean): void => {
|
|||
);
|
||||
|
||||
if (saveArchive) {
|
||||
if (!archive.value?.filter(post => post.filename === computedFilename.value) && !isDraft) {
|
||||
archive.value?.push({
|
||||
if (!archive.value?.filter(post => post.filename === computedFilename.value).length && !isDraft.value) {
|
||||
archive.value?.unshift({
|
||||
postTitle: postTitle.value,
|
||||
timestamp: postTimestamp.value,
|
||||
filename: computedFilename.value
|
||||
|
|
|
@ -24,8 +24,8 @@ export const parseFilename = (titleToFilename: string): string => {
|
|||
return titleToFilename;
|
||||
}
|
||||
|
||||
export const downloadFile = (dataPbj: any, fileName: string): void => {
|
||||
const blob = new Blob([JSON.stringify(dataPbj, null, 2)], { type: 'text/plain;charset=utf-8;' });
|
||||
export const downloadFile = (dataObj: any, fileName: string): void => {
|
||||
const blob = new Blob([JSON.stringify(dataObj, null, 2)], { type: 'text/plain;charset=utf-8;' });
|
||||
const a = document.createElement('a');
|
||||
a.setAttribute('download', `${fileName}.json`);
|
||||
a.setAttribute('href', window.URL.createObjectURL(blob));
|
||||
|
@ -45,7 +45,7 @@ export const loadFromFile = (file: any): Promise<Post> => {
|
|||
reader.onload = (event => {
|
||||
const contents: any = (event.target as FileReader).result;
|
||||
|
||||
// Yes, this is extremely hacky.
|
||||
// Yes, this is extremely hacky... Empty object just to test below. 'Cuz I'm lazy.
|
||||
const objCompare: Post = {
|
||||
postTitle: "",
|
||||
timestamp: "",
|
||||
|
|
Loading…
Reference in a new issue