Skip to content

Commit

Permalink
fix: eval error on mobile device (close #1865)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Nov 9, 2020
1 parent be6584c commit a5c5992
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions packages/maskbook/src/utils/hooks/useShareLink.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { template } from 'lodash-es'
import { getActivatedUI } from '../../social-network/ui'

export function useShareLink<T extends object>(tpl: string, payload?: T) {
const compiled = template(tpl)
export function useShareLink(message: string) {
switch (getActivatedUI()?.networkIdentifier) {
case 'twitter.com':
return `https://twitter.com/intent/tweet?text=${encodeURIComponent(compiled(payload))}`
return `https://twitter.com/intent/tweet?text=${encodeURIComponent(message)}`
case 'facebook.com':
return `https://www.facebook.com/sharer/sharer.php?quote=${encodeURIComponent(compiled(payload))}&u=mask.io`
return `https://www.facebook.com/sharer/sharer.php?quote=${encodeURIComponent(message)}&u=mask.io`
default:
return ''
}
Expand Down

0 comments on commit a5c5992

Please sign in to comment.