mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 03:54:16 +00:00
added spotify auth callback
This commit is contained in:
parent
9dd9e5f8b0
commit
a5b3c72dec
35
packages/app/src/pages/callbacks/sync/spotify/index.jsx
Normal file
35
packages/app/src/pages/callbacks/sync/spotify/index.jsx
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
import React from "react"
|
||||||
|
|
||||||
|
import * as antd from "antd"
|
||||||
|
|
||||||
|
import SyncModel from "models/sync"
|
||||||
|
|
||||||
|
export default (props) => {
|
||||||
|
const [error, setError] = React.useState(null)
|
||||||
|
|
||||||
|
const makeSync = async () => {
|
||||||
|
const result = await SyncModel.spotifyCore.syncAuthCode(window.location.search.split("=")[1]).catch((err) => {
|
||||||
|
setError(err.message)
|
||||||
|
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
if (result) {
|
||||||
|
window.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
React.useEffect(() => {
|
||||||
|
makeSync()
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
return <antd.Result
|
||||||
|
status="error"
|
||||||
|
title="Error while syncing your Spotify account"
|
||||||
|
subTitle={error}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
|
||||||
|
return <h3>Please wait meanwhile we are syncing your Spotify account</h3>
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user