Begin Netlify integration

This commit is contained in:
Tuan Dang
2022-12-13 21:12:40 -05:00
parent d86c335671
commit fe17d8459b
7 changed files with 114 additions and 17 deletions
+10 -5
View File
@@ -7,6 +7,8 @@ import AuthorizeIntegration from "./api/integrations/authorizeIntegration";
export default function Netlify() {
const router = useRouter();
const parsedUrl = queryString.parse(router.asPath.split("?")[1]);
const code = parsedUrl.code;
const state = parsedUrl.state;
// modify comment here
/**
@@ -14,16 +16,19 @@ export default function Netlify() {
*/
// eslint-disable-next-line react-hooks/exhaustive-deps
useEffect(async () => {
console.log('AA');
if (state === localStorage.getItem('latestCSRFToken')) {
localStorage.removeItem('latestCSRFToken');
console.log('Netlify', parsedUrl);
// http://localhost:8080/netlify?code=qnG0g_krhklWDpdUqfhU-t1sLeZzYI3gF2d6QVnL-Gc&state=3a78cd3154a9a99ddd4eb5d99dbb3289
// http://localhost:8080/netlify#access_token=d-78qUAnnSzvlgfG9Y_oUV6_4TQBxLbofImiBbKAjzE&token_type=Bearer&state=5da34fa49e301e9fa1a6e40925694b77
// await AuthorizeIntegration({
// workspaceId: localStorage.getItem('projectData.id'),
// code,
// integration: "vercel"
// });
await AuthorizeIntegration({
workspaceId: localStorage.getItem('projectData.id'),
code,
integration: "netlify"
});
// router.push("/integrations/" + localStorage.getItem("projectData.id"));
}