@ebubekirylmaz/link-test 1.2.32 → 1.2.34

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ebubekirylmaz/link-test",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./index.js",
@@ -94,14 +94,18 @@ function ProjectBar() {
94
94
  const refreshToken = storage.get("link", "refreshToken");
95
95
  const identityProvider = storage.get("link", "identityProvider");
96
96
 
97
- const request = oauth.post("/oauth", {
97
+ const payload = {
98
98
  appId,
99
- refreshToken,
100
99
  projectId,
101
100
  identityProvider,
102
- username: "admin",
103
- password: "admin",
104
- });
101
+ refreshToken,
102
+ };
103
+ if (identityProvider?.toUpperCase() === "DEMO") {
104
+ payload.username = "admin";
105
+ payload.password = "admin";
106
+ }
107
+
108
+ const request = oauth.post("/oauth", payload);
105
109
 
106
110
  request
107
111
  .then(({ data }) => {
@@ -1,6 +1,7 @@
1
1
  import { Button, Stack, TextField, Typography } from "@mui/material";
2
2
  import { confirmSignup, getTokens, login, signup } from "./amplifyAuth";
3
3
 
4
+ import config from "../../config/config";
4
5
  import { storage } from "@nucleoidjs/webstorage";
5
6
  import { useState } from "react";
6
7
 
@@ -12,6 +13,8 @@ export default function CognitoLogin() {
12
13
  const [password, setPassword] = useState("");
13
14
  const [code, setCode] = useState("");
14
15
 
16
+ const { appId } = config();
17
+
15
18
  const handleLogin = async () => {
16
19
  try {
17
20
  // 1️⃣ Login with Cognito
@@ -28,7 +31,7 @@ export default function CognitoLogin() {
28
31
  method: "POST",
29
32
  headers: { "Content-Type": "application/json" },
30
33
  body: JSON.stringify({
31
- appId: "greycollar-api",
34
+ appId: appId,
32
35
  projectId: "cb16e069-6214-47f1-9922-1f7fe7629525",
33
36
  identityProvider: "COGNITO",
34
37
  refreshToken: tokens.accessToken, // 🔥 Cognito ACCESS token