stratanodex 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/client.js
CHANGED
|
@@ -87,6 +87,7 @@ export const createCliSession = () => http
|
|
|
87
87
|
.post('/api/auth/cli-session')
|
|
88
88
|
.then((r) => ({
|
|
89
89
|
code: r.data.code,
|
|
90
|
+
url: r.data.url,
|
|
90
91
|
}));
|
|
91
92
|
export const pollCliSession = (code) => http.get(`/api/auth/cli-session/${code}`).then((r) => {
|
|
92
93
|
// Backend returns { pending: true } or { token: string }
|
|
@@ -7,7 +7,6 @@ import { createCliSession, pollCliSession } from '../../api/client.js';
|
|
|
7
7
|
import { saveToken } from '../../utils/auth.js';
|
|
8
8
|
import { ApiError } from '../../api/ApiError.js';
|
|
9
9
|
import chalk from 'chalk';
|
|
10
|
-
const AUTH_URL_BASE = process.env['STRATANODEX_AUTH_URL'] ?? 'https://stratanodex-landing-page.vercel.app';
|
|
11
10
|
const POLL_INTERVAL_MS = 2000;
|
|
12
11
|
export function LoginScreen({ replaceScreen, registerActions }) {
|
|
13
12
|
const [state, setState] = useState('creating');
|
|
@@ -28,12 +27,11 @@ export function LoginScreen({ replaceScreen, registerActions }) {
|
|
|
28
27
|
const attempt = ++attemptRef.current;
|
|
29
28
|
try {
|
|
30
29
|
// 1. Create CLI session on backend
|
|
31
|
-
const { code } = await createCliSession();
|
|
30
|
+
const { code, url } = await createCliSession();
|
|
32
31
|
if (attemptRef.current !== attempt)
|
|
33
32
|
return; // stale attempt
|
|
34
|
-
// 2. Open browser to auth
|
|
35
|
-
|
|
36
|
-
await open(`${AUTH_URL_BASE}${separator}session=${code}#auth`);
|
|
33
|
+
// 2. Open browser to the auth URL returned by the backend
|
|
34
|
+
await open(url);
|
|
37
35
|
setState('waiting');
|
|
38
36
|
// 3. Poll until complete or error
|
|
39
37
|
pollRef.current = setInterval(async () => {
|
package/package.json
CHANGED