Skip to content

Commit ad08959

Browse files
committed
works but not sure i get it
1 parent 7aa8178 commit ad08959

1 file changed

Lines changed: 21 additions & 19 deletions

File tree

src/store/cff.ts

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import { ref, computed } from 'vue'
22
import { AuthorsType, CffType, IdentifiersType, KeywordsType, TypeType } from '../types'
33

4-
const cffInitialValue = {
5-
abstract: undefined,
6-
authors: [],
7-
cffVersion: '1.2.0',
8-
commit: undefined,
9-
dateReleased: undefined,
10-
identifiers: undefined,
11-
keywords: undefined,
12-
license: undefined,
13-
message: undefined,
14-
repository: undefined,
15-
repositoryArtifact: undefined,
16-
repositoryCode: undefined,
17-
title: undefined,
18-
type: 'software',
19-
url: undefined,
20-
version: undefined
4+
const getInitialData = () => {
5+
return {
6+
abstract: undefined,
7+
authors: [],
8+
cffVersion: '1.2.0',
9+
commit: undefined,
10+
dateReleased: undefined,
11+
identifiers: undefined,
12+
keywords: undefined,
13+
license: undefined,
14+
message: undefined,
15+
repository: undefined,
16+
repositoryArtifact: undefined,
17+
repositoryCode: undefined,
18+
title: undefined,
19+
type: 'software',
20+
url: undefined,
21+
version: undefined
22+
} as CffType
2123
}
2224

23-
const cff = ref(cffInitialValue as CffType)
25+
const cff = ref(getInitialData())
2426

2527
export function useCff () {
2628
return {
@@ -56,7 +58,7 @@ export function useCff () {
5658
setUrl: (newUrl: string) => { cff.value.url = newUrl === '' ? undefined : newUrl },
5759
setVersion: (newVersion: string) => { cff.value.version = newVersion === '' ? undefined : newVersion },
5860
reset: () => {
59-
cff.value = cffInitialValue as CffType
61+
cff.value = getInitialData()
6062
}
6163
}
6264
}

0 commit comments

Comments
 (0)