-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdeeplinks.js
34 lines (31 loc) · 856 Bytes
/
deeplinks.js
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
export default function ({ store }) {
const prefills = location.hash.replace('#', '').split('/').filter(Boolean)
if (prefills.length > 1) {
store.commit('setView', 'send')
let type, username, repository, issue, amount, token
if (prefills[0] === 'u') {
type = 'send-user'
username = prefills[1]
amount = Number(prefills[2])
} else if (prefills[0] === 'r') {
type = 'send-repository'
username = prefills[1]
repository = prefills[2]
amount = Number(prefills[3])
} else if (prefills[0] === 'i') {
type = 'send-issue'
username = prefills[1]
repository = prefills[2]
issue = prefills[3]
amount = Number(prefills[4])
}
store.commit('setRedirectPrefills', {
type,
username,
repository,
issue,
amount,
token,
})
}
}