diff --git a/src/components/addpeer/MacTab.tsx b/src/components/addpeer/MacTab.tsx index ad787ad..892d66c 100644 --- a/src/components/addpeer/MacTab.tsx +++ b/src/components/addpeer/MacTab.tsx @@ -3,6 +3,7 @@ import React, {useState} from 'react'; import { Button } from "antd"; import TabSteps from "./TabSteps"; import { StepCommand } from "./types" +import { formatNetBirdUP } from "./common" export const LinuxTab = () => { @@ -30,9 +31,7 @@ export const LinuxTab = () => { { key: 3, title: 'Run NetBird and log in the browser:', - commands: [ - `sudo netbird up` - ].join('\n'), + commands: formatNetBirdUP(), copied: false, showCopyButton: true } as StepCommand, diff --git a/src/components/addpeer/UbuntuTab.tsx b/src/components/addpeer/UbuntuTab.tsx index 94376b4..ce744b6 100644 --- a/src/components/addpeer/UbuntuTab.tsx +++ b/src/components/addpeer/UbuntuTab.tsx @@ -5,21 +5,12 @@ import TabSteps from "./TabSteps"; import { StepCommand } from "./types" import { getConfig } from "../../config"; import Paragraph from 'antd/lib/skeleton/Paragraph'; -const { grpcApiOrigin } = getConfig(); +import { formatNetBirdUP } from "./common" + export const UbuntuTab = () => { - const formatNetBirdUP = () => { - let cmd = "sudo netbird up" - if (grpcApiOrigin) { - cmd = "sudo netbird up --management-url " + grpcApiOrigin - } - return [ - cmd - ].join('\n') - } - const [steps, setSteps] = useState([ { key: 1, diff --git a/src/components/addpeer/common.ts b/src/components/addpeer/common.ts new file mode 100644 index 0000000..e348ad0 --- /dev/null +++ b/src/components/addpeer/common.ts @@ -0,0 +1,13 @@ +import {getConfig} from "../../config"; +const { grpcApiOrigin } = getConfig(); + + +export const formatNetBirdUP = () => { + let cmd = "sudo netbird up" + if (grpcApiOrigin) { + cmd = "sudo netbird up --management-url " + grpcApiOrigin + } + return [ + cmd + ].join('\n') +} \ No newline at end of file