Skip to content

Commit

Permalink
fix(dropbox): correct redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Oct 3, 2021
1 parent 29982b1 commit 433127e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
const onClick = () => {
window.open(
`https://www.dropbox.com/oauth2/authorize?client_id=${useEnv().dropboxKey()}&response_type=token&redirect_uri=http://localhost:3000/better-write/&scope=account_info.read files.metadata.write files.metadata.read files.content.write files.content.read`,
`https://www.dropbox.com/oauth2/authorize?client_id=${useEnv().dropboxKey()}&response_type=token&redirect_uri=${useEnv().getCorrectLocalUrl()}&scope=account_info.read files.metadata.write files.metadata.read files.content.write files.content.read`,
'_self'
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ declare module '*.vue' {
export default component
}

declare var Dropbox: any;
declare var Dropbox: any

declare module '@heroicons/vue'
declare module 'keyboardjs'
Expand Down
7 changes: 7 additions & 0 deletions src/use/env.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { Callback } from '@/types/utils'

export const useEnv: Callback<any> = () => {
const getCorrectLocalUrl = () => {
return import.meta.env.PROD
? 'https://novout.github.io/better-write/'
: 'localhost:3000/better-write/'
}

const projectEmpty = (): string => {
return import.meta.env.VITE_PROJECT_EMPTY as string
}
Expand Down Expand Up @@ -34,5 +40,6 @@ export const useEnv: Callback<any> = () => {
isEmptyProject,
maxFonts,
production,
getCorrectLocalUrl,
}
}

0 comments on commit 433127e

Please sign in to comment.