@daeryun/dr_components 1.2.25 → 1.2.26

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,56 @@
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
+ export const checkLogoutLog = () => __awaiter(void 0, void 0, void 0, function* () {
11
+ try {
12
+ const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
13
+ method: 'GET',
14
+ headers: {
15
+ 'Content-Type': 'application/json'
16
+ },
17
+ credentials: 'include'
18
+ }).then(obj => obj.json());
19
+ return result;
20
+ }
21
+ catch (e) {
22
+ return '';
23
+ }
24
+ });
25
+ // 브라우저 쿠키 차단시 쿠키 생성
26
+ export const createLogoutLog = () => __awaiter(void 0, void 0, void 0, function* () {
27
+ try {
28
+ const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
29
+ method: 'POST',
30
+ headers: {
31
+ 'Content-Type': 'application/json'
32
+ },
33
+ credentials: 'include'
34
+ }).then(obj => obj.json());
35
+ return result;
36
+ }
37
+ catch (e) {
38
+ return '';
39
+ }
40
+ });
41
+ // 브라우저 쿠키 차단시 쿠키 삭제
42
+ export const deleteLogoutLog = () => __awaiter(void 0, void 0, void 0, function* () {
43
+ try {
44
+ const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
45
+ method: 'DELETE',
46
+ headers: {
47
+ 'Content-Type': 'application/json'
48
+ },
49
+ credentials: 'include'
50
+ }).then(obj => obj.json());
51
+ return result;
52
+ }
53
+ catch (e) {
54
+ return '';
55
+ }
56
+ });
@@ -0,0 +1,49 @@
1
+
2
+
3
+ export const checkLogoutLog = async () => {
4
+ try {
5
+ const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
6
+ method: 'GET',
7
+ headers: {
8
+ 'Content-Type': 'application/json'
9
+ },
10
+ credentials: 'include'
11
+ }).then(obj => obj.json());
12
+
13
+ return result;
14
+ } catch (e) {
15
+ return '';
16
+ }
17
+ };
18
+
19
+ // 브라우저 쿠키 차단시 쿠키 생성
20
+ export const createLogoutLog = async () => {
21
+ try {
22
+ const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
23
+ method: 'POST',
24
+ headers: {
25
+ 'Content-Type': 'application/json'
26
+ },
27
+ credentials: 'include'
28
+ }).then(obj => obj.json());
29
+ return result;
30
+ } catch (e) {
31
+ return '';
32
+ }
33
+ }
34
+
35
+ // 브라우저 쿠키 차단시 쿠키 삭제
36
+ export const deleteLogoutLog = async () => {
37
+ try {
38
+ const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/get-auth/logout-log`, {
39
+ method: 'DELETE',
40
+ headers: {
41
+ 'Content-Type': 'application/json'
42
+ },
43
+ credentials: 'include'
44
+ }).then(obj => obj.json());
45
+ return result;
46
+ } catch (e) {
47
+ return '';
48
+ }
49
+ };
@@ -7,18 +7,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
7
7
  step((generator = generator.apply(thisArg, _arguments || [])).next());
8
8
  });
9
9
  };
10
+ import Fetch from "../_fetch/fetch";
10
11
  const logout = () => __awaiter(void 0, void 0, void 0, function* () {
11
12
  const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
12
13
  try {
13
- // const res = await Fetch('/api/lawfirm/app/auth/logout', {
14
- // method: 'POST'
15
- // });
16
- const res = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
14
+ const res = yield Fetch(`/api/lawfirm/app/auth/logout`, {
17
15
  method: 'POST',
18
- headers: { 'Content-Type': 'application/json' },
19
- cache: 'no-cache',
20
16
  credentials: 'include'
21
- }).then(res => res.json());
17
+ });
18
+ // const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
19
+ // method: 'POST',
20
+ // headers: { 'Content-Type': 'application/json' },
21
+ // cache: 'no-cache',
22
+ // credentials: 'include'
23
+ // }).then((res) => res.json())
22
24
  if (res.result) {
23
25
  const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
24
26
  method: 'DELETE',
@@ -1,15 +1,18 @@
1
+ import Fetch from "../_fetch/fetch";
2
+
1
3
  const logout = async () => {
2
4
  const SESSION_KEY = process.env.NEXT_PUBLIC_USER_SESSION_STORAGE_KEY || 'loginUser';
3
5
  try {
4
- // const res = await Fetch('/api/lawfirm/app/auth/logout', {
5
- // method: 'POST'
6
- // });
7
- const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
6
+ const res = await Fetch(`/api/lawfirm/app/auth/logout`, {
8
7
  method: 'POST',
9
- headers: { 'Content-Type': 'application/json' },
10
- cache: 'no-cache',
11
8
  credentials: 'include'
12
- }).then(res => res.json());
9
+ })
10
+ // const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
11
+ // method: 'POST',
12
+ // headers: { 'Content-Type': 'application/json' },
13
+ // cache: 'no-cache',
14
+ // credentials: 'include'
15
+ // }).then((res) => res.json())
13
16
  if (res.result) {
14
17
  const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
15
18
  method: 'DELETE',
@@ -8,9 +8,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
+ import { createLogoutLog } from '../_api/checkLogoutLog';
12
+ import checkThirdPartyCookie from '../_api/checkThirdPartyCookie';
11
13
  // 로펌용
12
- import { deleteToken } from '../_api/token';
14
+ import { deleteToken, getToken } from '../_api/token';
13
15
  const Fetch = (url_1, ...args_1) => __awaiter(void 0, [url_1, ...args_1], void 0, function* (url, options = {}) {
16
+ if (url === '/api/lawfirm/app/auth/logout') {
17
+ const result = yield getToken();
18
+ const isCookie = yield checkThirdPartyCookie();
19
+ // console.log('isCookie', isCookie);
20
+ if (!isCookie) {
21
+ yield createLogoutLog();
22
+ // console.log('res', res);
23
+ }
24
+ const res = yield fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
25
+ method: 'POST',
26
+ headers: { 'Content-Type': 'application/json', 'Authorization': `${result || ''}` },
27
+ cache: 'no-cache',
28
+ credentials: 'include'
29
+ }).then((res) => res.json());
30
+ // console.log('res', res);
31
+ return res;
32
+ }
14
33
  options = Object.assign(Object.assign({}, options), { credentials: 'include' });
15
34
  options.headers = Object.assign(Object.assign({}, options.headers), { Accept: 'application/json;charset=UTF-8' });
16
35
  if ((options === null || options === void 0 ? void 0 : options.method) === 'POST' && options.type !== 'form') {
@@ -1,9 +1,31 @@
1
1
  'use client';
2
+ import { createLogoutLog } from '../_api/checkLogoutLog';
3
+ import checkThirdPartyCookie from '../_api/checkThirdPartyCookie';
2
4
  // 로펌용
3
5
 
4
- import { deleteToken } from '../_api/token';
6
+ import { deleteToken, getToken } from '../_api/token';
5
7
 
6
8
  const Fetch = async (url: string, options: any = {}) => {
9
+
10
+ if (url ==='/api/lawfirm/app/auth/logout') {
11
+ const result = await getToken();
12
+ const isCookie = await checkThirdPartyCookie();
13
+ // console.log('isCookie', isCookie);
14
+ if(!isCookie){
15
+ await createLogoutLog();
16
+ // console.log('res', res);
17
+ }
18
+
19
+ const res = await fetch(`${process.env.NEXT_PUBLIC_LAWFIRM_API}/api/app/auth/logout`, {
20
+ method: 'POST',
21
+ headers: { 'Content-Type': 'application/json', 'Authorization': `${result ||''}` },
22
+ cache: 'no-cache',
23
+ credentials: 'include'
24
+ }).then((res) => res.json())
25
+ // console.log('res', res);
26
+
27
+ return res;
28
+ }
7
29
  options = {
8
30
  ...options,
9
31
  credentials: 'include'