forked from kodadot/nft-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentityMint.ts
47 lines (41 loc) · 1011 Bytes
/
identityMint.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { defineStore } from 'pinia'
export interface MintInfo {
created: {
totalCount: number
}
firstMintDate: Date
updatedAt: number
lastBoughtDate?: Date
}
export interface IdentityMintMap {
[address: string]: MintInfo
}
export interface IdentityMintStruct {
identities: IdentityMintMap
}
export interface IdentityMintRequest {
address: string
cacheData: MintInfo
}
interface State {
identities: IdentityMintMap
}
export const useIdentityMintStore = defineStore('identityMint', {
state: (): State => ({
identities: {},
}),
getters: {
// getIdentityMintFor: (state) => (address: string) => MintInfo | undefined {
// return (address: string) => state.identities[address]
// },
},
actions: {
getIdentityMintFor(address: string) {
return this.identities[address]
},
setIdentity(identityMintRequest: IdentityMintRequest) {
const { address, cacheData } = identityMintRequest
this.identities[address] = cacheData
},
},
})