Merge branch 'feature/new-user-routes' into 'develop'

Make domain.com/username routes work

Closes pleroma#395

See merge request pleroma/pleroma-fe!392
This commit is contained in:
lambda 2018-12-18 15:26:00 +00:00
commit 2f28bf95fd
32 changed files with 1778 additions and 728 deletions

View file

@ -5,7 +5,7 @@ const getOrCreateApp = ({oauth, instance}) => {
const form = new window.FormData()
form.append('client_name', `PleromaFE_${Math.random()}`)
form.append('redirect_uris', `${window.location.origin}/oauth-callback`)
form.append('redirect_uris', `${window.location.origin}/~/oauth-callback`)
form.append('scopes', 'read write follow')
return window.fetch(url, {
@ -64,7 +64,7 @@ const getToken = ({app, instance, code}) => {
form.append('client_secret', app.client_secret)
form.append('grant_type', 'authorization_code')
form.append('code', code)
form.append('redirect_uri', `${window.location.origin}/oauth-callback`)
form.append('redirect_uri', `${window.location.origin}/~/oauth-callback`)
return window.fetch(url, {
method: 'POST',

View file

@ -0,0 +1,10 @@
const generateProfileLink = (id, screenName) => {
return {
name: (isExternal(screenName) ? 'external-user-profile' : 'user-profile'),
params: (isExternal(screenName) ? { id } : { name: screenName })
}
}
const isExternal = screenName => screenName.includes('@')
export default generateProfileLink