@daeryun/dr_components 0.3.90 → 0.3.91

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.
@@ -0,0 +1,2 @@
1
+ /** 쿠키 허용 여부 확인 */
2
+ export declare const checkThirdPartyCookie: () => Promise<any>;
@@ -0,0 +1,29 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /** 쿠키 허용 여부 확인 */
11
+ export const checkThirdPartyCookie = () => __awaiter(void 0, void 0, void 0, function* () {
12
+ try {
13
+ const createCookieResult = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth`, {
14
+ method: 'POST',
15
+ credentials: 'include'
16
+ }).then(res => res.json());
17
+ if (createCookieResult.result) {
18
+ const checkCookieResult = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/check`, {
19
+ method: 'GET',
20
+ credentials: 'include'
21
+ }).then(res => res.json());
22
+ return checkCookieResult.result && !checkCookieResult.message;
23
+ }
24
+ }
25
+ catch (error) {
26
+ console.error('Error checking third-party cookies:', error);
27
+ }
28
+ return false;
29
+ });
@@ -0,0 +1,21 @@
1
+ /** 쿠키 허용 여부 확인 */
2
+ export const checkThirdPartyCookie = async () => {
3
+ try {
4
+ const createCookieResult = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth`, {
5
+ method: 'POST',
6
+ credentials: 'include'
7
+ }).then(res => res.json());
8
+
9
+ if (createCookieResult.result) {
10
+ const checkCookieResult = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/check`, {
11
+ method: 'GET',
12
+ credentials: 'include'
13
+ }).then(res => res.json());
14
+
15
+ return checkCookieResult.result && !checkCookieResult.message;
16
+ }
17
+ } catch (error) {
18
+ console.error('Error checking third-party cookies:', error);
19
+ }
20
+ return false;
21
+ };
@@ -0,0 +1,2 @@
1
+ /** 로그인 콜백 처리 */
2
+ export declare const fetchAuthCallback: () => Promise<any>;
@@ -0,0 +1,18 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /** 로그인 콜백 처리 */
11
+ export const fetchAuthCallback = () => __awaiter(void 0, void 0, void 0, function* () {
12
+ return yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/callback`, {
13
+ method: 'GET',
14
+ headers: { 'Content-Type': 'application/json' },
15
+ cache: 'no-cache',
16
+ credentials: 'include'
17
+ }).then(res => res.json());
18
+ });
@@ -0,0 +1,9 @@
1
+ /** 로그인 콜백 처리 */
2
+ export const fetchAuthCallback = async () => {
3
+ return await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/callback`, {
4
+ method: 'GET',
5
+ headers: { 'Content-Type': 'application/json' },
6
+ cache: 'no-cache',
7
+ credentials: 'include'
8
+ }).then(res => res.json());
9
+ };
@@ -0,0 +1,3 @@
1
+ import { ILoginInfo } from '../_types/login';
2
+ /** 쿠키 허용 시 유저 정보 조회 */
3
+ export declare const fetchUserData: () => Promise<ILoginInfo | null>;
@@ -0,0 +1,23 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ /** 쿠키 허용 시 유저 정보 조회 */
11
+ export const fetchUserData = () => __awaiter(void 0, void 0, void 0, function* () {
12
+ var _a, _b;
13
+ const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/lawfirm/app/user`, {
14
+ method: 'GET',
15
+ headers: { 'Content-Type': 'application/json' },
16
+ cache: 'no-cache',
17
+ credentials: 'include'
18
+ }).then(res => res.json());
19
+ if (((_a = result.data) === null || _a === void 0 ? void 0 : _a.email) && ((_b = result.data) === null || _b === void 0 ? void 0 : _b.name)) {
20
+ return { email: result.data.email, name: result.data.name, provider: result.data.provider, isLogin: true };
21
+ }
22
+ return null;
23
+ });
@@ -0,0 +1,16 @@
1
+ import { ILoginInfo } from '../_types/login';
2
+
3
+ /** 쿠키 허용 시 유저 정보 조회 */
4
+ export const fetchUserData = async (): Promise<ILoginInfo | null> => {
5
+ const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/lawfirm/app/user`, {
6
+ method: 'GET',
7
+ headers: { 'Content-Type': 'application/json' },
8
+ cache: 'no-cache',
9
+ credentials: 'include'
10
+ }).then(res => res.json());
11
+
12
+ if (result.data?.email && result.data?.name) {
13
+ return { email: result.data.email, name: result.data.name, provider: result.data.provider, isLogin: true };
14
+ }
15
+ return null;
16
+ };