-
-
-
Connect your repository
-
-
- {!!repo &&
}
-
+ const cancelConnection = useCallback(async () => {
+ await (
+ await fetch(`/settings/repository/${id}`, {
+ method: 'DELETE',
+ })
+ ).json();
+
+ deleteRepository();
+ }, []);
+
+ const completeConnection = useCallback(async () => {
+ setConnected(`${select}/${repo}`);
+ await (
+ await fetch(`/settings/organizations/${id}`, {
+ method: 'POST',
+ body: JSON.stringify({ login: `${select}/${repo}` }),
+ })
+ ).json();
+ }, [repo, select]);
+
+ return (
+
+
+
+
- );
-}
+
Connect your repository
+
+
+
+ {!!repo &&
}
+
+
+ );
+};
-export const GithubComponent: FC<{ organizations: Array<{ login: string, id: string }>, github: Array<{ id: string, login: string }> }> = (props) => {
- const {github, organizations} = props;
- const [githubState, setGithubState] = useState(github);
- const fetch = useFetch();
- const connect = useCallback(async () => {
- const {url} = await (await fetch('/settings/github/url')).json();
- window.location.href = url;
- }, []);
+export const GithubComponent: FC<{
+ organizations: Array<{ login: string; id: string }>;
+ github: Array<{ id: string; login: string }>;
+}> = (props) => {
+ const { github, organizations } = props;
+ const [githubState, setGithubState] = useState(github);
+ const fetch = useFetch();
+ const connect = useCallback(async () => {
+ const { url } = await (await fetch('/settings/github/url')).json();
+ window.location.href = url;
+ }, []);
- const setConnected = useCallback((g: {id: string, login: string}) => (name: string) => {
- setGithubState((gitlibs) => {
- return gitlibs.map((git, index) => {
- if (git.id === g.id) {
- return {id: g.id, login: name};
- }
- return git;
- })
+ const setConnected = useCallback(
+ (g: { id: string; login: string }) => (name: string) => {
+ setGithubState((gitlibs) => {
+ return gitlibs.map((git, index) => {
+ if (git.id === g.id) {
+ return { id: g.id, login: name };
+ }
+ return git;
});
- }, [githubState]);
+ });
+ },
+ [githubState]
+ );
- const deleteConnect = useCallback((g: {id: string, login: string}) => () => {
- setGithubState((gitlibs) => {
- return gitlibs.filter((git, index) => {
- return git.id !== g.id;
- })
+ const deleteConnect = useCallback(
+ (g: { id: string; login: string }) => () => {
+ setGithubState((gitlibs) => {
+ return gitlibs.filter((git, index) => {
+ return git.id !== g.id;
});
- }, [githubState]);
+ });
+ },
+ [githubState]
+ );
- return (
+ return (
+ <>
+ {githubState.map((g) => (
<>
- {githubState.map(g => (
- <>
- {!g.login ? (
-
- ): (
-
- )}
- >
- ))}
- {githubState.filter(f => !f.login).length === 0 && (
-
-
-
Connect your repository
-
-
-
- )}
+ {!g.login ? (
+
+ ) : (
+
+ )}
>
- )
-}
\ No newline at end of file
+ ))}
+ {githubState.filter((f) => !f.login).length === 0 && (
+
+
+
+
+
+
Connect your repository
+
+
+
+ )}
+ >
+ );
+};
diff --git a/apps/frontend/src/components/settings/settings.component.tsx b/apps/frontend/src/components/settings/settings.component.tsx
index 0f69fe1d..7e5912a4 100644
--- a/apps/frontend/src/components/settings/settings.component.tsx
+++ b/apps/frontend/src/components/settings/settings.component.tsx
@@ -15,8 +15,6 @@ export const SettingsComponent = () => {
const fetch = useFetch();
- console.log(user);
-
const load = useCallback(async (path: string) => {
const { github } = await (await fetch('/settings/github')).json();
if (!github) {