@daeryun/dr_components 0.3.17 → 0.3.19

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.
Files changed (92) hide show
  1. package/dist/components/Layout/PageWrapper.d.ts +8 -0
  2. package/dist/components/Layout/PageWrapper.jsx +31 -0
  3. package/dist/components/Layout/PageWrapper.tsx +35 -0
  4. package/dist/components/page/Login/Login.d.ts +6 -0
  5. package/dist/components/page/Login/Login.jsx +112 -0
  6. package/dist/components/page/Login/Login.stories.d.ts +6 -0
  7. package/dist/components/page/Login/Login.stories.jsx +13 -0
  8. package/dist/components/page/Login/Login.stories.tsx +21 -0
  9. package/dist/components/page/Login/Login.tsx +167 -0
  10. package/dist/components/page/Login/LoginComp/LButton.d.ts +9 -0
  11. package/dist/components/page/Login/LoginComp/LButton.jsx +14 -0
  12. package/dist/components/page/Login/LoginComp/LButton.tsx +36 -0
  13. package/dist/components/page/Login/LoginComp/Linput.d.ts +11 -0
  14. package/dist/components/page/Login/LoginComp/Linput.jsx +10 -0
  15. package/dist/components/page/Login/LoginComp/Linput.tsx +40 -0
  16. package/dist/components/page/Login/LoginComp/LoginBreadCrumb.d.ts +6 -0
  17. package/dist/components/page/Login/LoginComp/LoginBreadCrumb.jsx +18 -0
  18. package/dist/components/page/Login/LoginComp/LoginBreadCrumb.tsx +40 -0
  19. package/dist/components/page/Login/LoginComp/Modal/AlertConfirmModal.d.ts +10 -0
  20. package/dist/components/page/Login/LoginComp/Modal/AlertConfirmModal.jsx +41 -0
  21. package/dist/components/page/Login/LoginComp/Modal/AlertConfirmModal.tsx +91 -0
  22. package/dist/components/page/Login/LoginComp/Modal/ConfirmModal.d.ts +10 -0
  23. package/dist/components/page/Login/LoginComp/Modal/ConfirmModal.jsx +37 -0
  24. package/dist/components/page/Login/LoginComp/Modal/ConfirmModal.tsx +83 -0
  25. package/dist/components/page/Login/LoginComp/Modal/TermModal.d.ts +9 -0
  26. package/dist/components/page/Login/LoginComp/Modal/TermModal.jsx +39 -0
  27. package/dist/components/page/Login/LoginComp/Modal/TermModal.tsx +70 -0
  28. package/dist/components/page/Login/LoginComp/Sign/OptionalCheckBox.d.ts +14 -0
  29. package/dist/components/page/Login/LoginComp/Sign/OptionalCheckBox.jsx +61 -0
  30. package/dist/components/page/Login/LoginComp/Sign/OptionalCheckBox.tsx +160 -0
  31. package/dist/components/page/Login/LoginComp/Sign/RequiredCheckBox.d.ts +12 -0
  32. package/dist/components/page/Login/LoginComp/Sign/RequiredCheckBox.jsx +32 -0
  33. package/dist/components/page/Login/LoginComp/Sign/RequiredCheckBox.tsx +94 -0
  34. package/dist/components/page/Login/Sign.d.ts +27 -0
  35. package/dist/components/page/Login/Sign.jsx +614 -0
  36. package/dist/components/page/Login/Sign.tsx +941 -0
  37. package/dist/components/page/Login/_api/completeUser.d.ts +7 -0
  38. package/dist/components/page/Login/_api/completeUser.js +23 -0
  39. package/dist/components/page/Login/_api/completeUser.ts +18 -0
  40. package/dist/components/page/Login/_api/confirmNumber.d.ts +5 -0
  41. package/dist/components/page/Login/_api/confirmNumber.js +23 -0
  42. package/dist/components/page/Login/_api/confirmNumber.ts +14 -0
  43. package/dist/components/page/Login/_api/getLoginStatus.d.ts +12 -0
  44. package/dist/components/page/Login/_api/getLoginStatus.js +48 -0
  45. package/dist/components/page/Login/_api/getLoginStatus.ts +42 -0
  46. package/dist/components/page/Login/_api/logout.d.ts +1 -0
  47. package/dist/components/page/Login/_api/logout.js +29 -0
  48. package/dist/components/page/Login/_api/logout.ts +18 -0
  49. package/dist/components/page/Login/_api/optionalTermAgree.d.ts +6 -0
  50. package/dist/components/page/Login/_api/optionalTermAgree.js +27 -0
  51. package/dist/components/page/Login/_api/optionalTermAgree.ts +23 -0
  52. package/dist/components/page/Login/_api/sendNumber.d.ts +5 -0
  53. package/dist/components/page/Login/_api/sendNumber.js +24 -0
  54. package/dist/components/page/Login/_api/sendNumber.ts +15 -0
  55. package/dist/components/page/Login/_api/token.d.ts +2 -0
  56. package/dist/components/page/Login/_api/token.js +33 -0
  57. package/dist/components/page/Login/_api/token.ts +25 -0
  58. package/dist/components/page/Login/_api/updateUserInfo.d.ts +6 -0
  59. package/dist/components/page/Login/_api/updateUserInfo.js +26 -0
  60. package/dist/components/page/Login/_api/updateUserInfo.ts +17 -0
  61. package/dist/components/page/Login/_api/withdraw.d.ts +5 -0
  62. package/dist/components/page/Login/_api/withdraw.js +23 -0
  63. package/dist/components/page/Login/_api/withdraw.ts +14 -0
  64. package/dist/components/page/Login/_fetch/fetch.d.ts +2 -0
  65. package/dist/components/page/Login/_fetch/fetch.js +54 -0
  66. package/dist/components/page/Login/_fetch/fetch.ts +58 -0
  67. package/dist/components/page/Login/_fetch/serverFetch.d.ts +2 -0
  68. package/dist/components/page/Login/_fetch/serverFetch.js +37 -0
  69. package/dist/components/page/Login/_fetch/serverFetch.ts +43 -0
  70. package/dist/components/page/MyCase/MyCasePage.jsx +1 -0
  71. package/dist/components/page/MyCase/MyCasePage.tsx +2 -0
  72. package/dist/components/page/MyCase/[id]/MyCaseDetailPage.jsx +1 -0
  73. package/dist/components/page/MyCase/[id]/MyCaseDetailPage.tsx +2 -0
  74. package/dist/components/page/MyCase/_fetchers/addMyCaseQuestion.js +3 -1
  75. package/dist/components/page/MyCase/_fetchers/addMyCaseQuestion.ts +3 -1
  76. package/dist/components/page/MyCase/_fetchers/getCase.js +4 -1
  77. package/dist/components/page/MyCase/_fetchers/getCase.ts +5 -1
  78. package/dist/components/page/MyCase/_fetchers/getCaseList.js +3 -1
  79. package/dist/components/page/MyCase/_fetchers/getCaseList.ts +3 -1
  80. package/dist/components/page/MyCase/_fetchers/getCourtFileList.js +3 -1
  81. package/dist/components/page/MyCase/_fetchers/getCourtFileList.ts +3 -1
  82. package/dist/components/page/MyCase/_fetchers/getMyCaseQuestion.js +3 -1
  83. package/dist/components/page/MyCase/_fetchers/getMyCaseQuestion.ts +8 -9
  84. package/dist/components/page/index.d.ts +2 -0
  85. package/dist/components/page/index.js +2 -0
  86. package/dist/components/page/index.ts +2 -0
  87. package/dist/lib/utils.d.ts +16 -0
  88. package/dist/lib/utils.js +50 -0
  89. package/dist/lib/utils.ts +63 -0
  90. package/dist/styles/globals.css +1200 -31
  91. package/dist/tsconfig.tsbuildinfo +1 -1
  92. package/package.json +2 -1
@@ -0,0 +1,7 @@
1
+ export declare const completeUserSign: ({ bodyData }: {
2
+ bodyData: {
3
+ name: string;
4
+ phoneNumber: string;
5
+ uuid: string;
6
+ };
7
+ }) => Promise<any>;
@@ -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
+ import Fetch from '../_fetch/fetch';
11
+ export const completeUserSign = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bodyData }) {
12
+ try {
13
+ const res = yield Fetch(`/api/lawfirm/app/user`, {
14
+ method: 'POST',
15
+ body: JSON.stringify(bodyData)
16
+ });
17
+ return res;
18
+ }
19
+ catch (e) {
20
+ console.error('Error sending number:', e);
21
+ throw e; // Rethrow for handling in the calling function
22
+ }
23
+ });
@@ -0,0 +1,18 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const completeUserSign = async ({
4
+ bodyData
5
+ }: {
6
+ bodyData: { name: string; phoneNumber: string; uuid: string };
7
+ }) => {
8
+ try {
9
+ const res = await Fetch(`/api/lawfirm/app/user`, {
10
+ method: 'POST',
11
+ body: JSON.stringify(bodyData)
12
+ });
13
+ return res;
14
+ } catch (e) {
15
+ console.error('Error sending number:', e);
16
+ throw e; // Rethrow for handling in the calling function
17
+ }
18
+ };
@@ -0,0 +1,5 @@
1
+ export declare const confirmNumber: ({ bodyData }: {
2
+ bodyData: {
3
+ code: string;
4
+ };
5
+ }) => Promise<any>;
@@ -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
+ import Fetch from '../_fetch/fetch';
11
+ export const confirmNumber = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bodyData }) {
12
+ try {
13
+ const res = yield Fetch(`/api/lawfirm/app/auth/verify-code`, {
14
+ method: 'POST',
15
+ body: JSON.stringify(bodyData)
16
+ });
17
+ return yield res; // Return API response if needed
18
+ }
19
+ catch (e) {
20
+ console.error('Error sending number:', e);
21
+ throw e; // Rethrow for handling in the calling function
22
+ }
23
+ });
@@ -0,0 +1,14 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const confirmNumber = async ({ bodyData }: { bodyData: { code: string } }) => {
4
+ try {
5
+ const res = await Fetch(`/api/lawfirm/app/auth/verify-code`, {
6
+ method: 'POST',
7
+ body: JSON.stringify(bodyData)
8
+ });
9
+ return await res; // Return API response if needed
10
+ } catch (e) {
11
+ console.error('Error sending number:', e);
12
+ throw e; // Rethrow for handling in the calling function
13
+ }
14
+ };
@@ -0,0 +1,12 @@
1
+ export declare const getLoginStatus: () => Promise<boolean>;
2
+ export declare const getLoginInfo: () => Promise<{
3
+ result: boolean;
4
+ data: null;
5
+ } | {
6
+ result: boolean;
7
+ data: {
8
+ name: any;
9
+ email: any;
10
+ provider: any;
11
+ };
12
+ }>;
@@ -0,0 +1,48 @@
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
+ import Fetch from '../_fetch/fetch';
11
+ export const getLoginStatus = () => __awaiter(void 0, void 0, void 0, function* () {
12
+ try {
13
+ const res = yield Fetch(`/api/lawfirm/app/user`, {
14
+ method: 'GET'
15
+ });
16
+ if (!res || !res.result || !res.data) {
17
+ return false;
18
+ }
19
+ return Boolean(res.data.name && res.data.phone_number);
20
+ }
21
+ catch (e) {
22
+ console.error('Error fetching login status:', e);
23
+ return false;
24
+ }
25
+ });
26
+ export const getLoginInfo = () => __awaiter(void 0, void 0, void 0, function* () {
27
+ try {
28
+ const res = yield Fetch(`/api/lawfirm/app/user`, {
29
+ method: 'GET'
30
+ });
31
+ if (!res || !res.result || !res.data) {
32
+ return { result: false, data: null }; // 로그인 상태가 아님
33
+ }
34
+ return {
35
+ result: true,
36
+ data: {
37
+ name: res.data.name,
38
+ email: res.data.email,
39
+ provider: res.data.provider
40
+ }
41
+ }; // 로그인 상태가 아님
42
+ // return Boolean(res.data.name && res.data.phone_number);
43
+ }
44
+ catch (e) {
45
+ console.error('Error fetching login status:', e);
46
+ return { result: false, data: null }; // 로그인 상태가 아님
47
+ }
48
+ });
@@ -0,0 +1,42 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const getLoginStatus = async () => {
4
+ try {
5
+ const res = await Fetch(`/api/lawfirm/app/user`, {
6
+ method: 'GET'
7
+ });
8
+ if (!res || !res.result || !res.data) {
9
+ return false;
10
+ }
11
+
12
+ return Boolean(res.data.name && res.data.phone_number);
13
+ } catch (e) {
14
+ console.error('Error fetching login status:', e);
15
+ return false;
16
+ }
17
+ };
18
+
19
+ export const getLoginInfo = async () => {
20
+ try {
21
+ const res = await Fetch(`/api/lawfirm/app/user`, {
22
+ method: 'GET'
23
+ });
24
+ if (!res || !res.result || !res.data) {
25
+ return { result: false, data: null }; // 로그인 상태가 아님
26
+ }
27
+
28
+ return {
29
+ result: true,
30
+ data: {
31
+ name: res.data.name,
32
+ email: res.data.email,
33
+ provider: res.data.provider
34
+ }
35
+ }; // 로그인 상태가 아님
36
+
37
+ // return Boolean(res.data.name && res.data.phone_number);
38
+ } catch (e) {
39
+ console.error('Error fetching login status:', e);
40
+ return { result: false, data: null }; // 로그인 상태가 아님
41
+ }
42
+ };
@@ -0,0 +1 @@
1
+ export declare const logout: () => Promise<string>;
@@ -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
+ export const logout = () => __awaiter(void 0, void 0, void 0, function* () {
11
+ try {
12
+ const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/logout`, {
13
+ headers: {
14
+ 'Content-Type': 'application/json'
15
+ },
16
+ credentials: 'include'
17
+ }).then(obj => obj.json());
18
+ if (result.result) {
19
+ window.location.href = '/';
20
+ }
21
+ else {
22
+ yield logout();
23
+ }
24
+ return '';
25
+ }
26
+ catch (e) {
27
+ return '';
28
+ }
29
+ });
@@ -0,0 +1,18 @@
1
+ export const logout = async () => {
2
+ try {
3
+ const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/logout`, {
4
+ headers: {
5
+ 'Content-Type': 'application/json'
6
+ },
7
+ credentials: 'include'
8
+ }).then(obj => obj.json());
9
+ if (result.result) {
10
+ window.location.href = '/';
11
+ } else {
12
+ await logout();
13
+ }
14
+ return '';
15
+ } catch (e) {
16
+ return '';
17
+ }
18
+ };
@@ -0,0 +1,6 @@
1
+ export declare const optionalTermAgree: ({ bodyData }: {
2
+ bodyData: {
3
+ alert_agree: number;
4
+ marketing_agree: number;
5
+ };
6
+ }) => Promise<any>;
@@ -0,0 +1,27 @@
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
+ import Fetch from '../_fetch/fetch';
11
+ export const optionalTermAgree = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bodyData }) {
12
+ const VALID_VALUES = Array.from({ length: 16 }, (_, i) => i);
13
+ if (!VALID_VALUES.includes(bodyData.alert_agree) || !VALID_VALUES.includes(bodyData.marketing_agree)) {
14
+ return { result: false };
15
+ }
16
+ try {
17
+ const res = yield Fetch(`/api/lawfirm/app/user/agree`, {
18
+ method: 'POST',
19
+ body: JSON.stringify(bodyData)
20
+ });
21
+ return yield res;
22
+ }
23
+ catch (e) {
24
+ console.error('Error sending number:', e);
25
+ return { result: false };
26
+ }
27
+ });
@@ -0,0 +1,23 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const optionalTermAgree = async ({
4
+ bodyData
5
+ }: {
6
+ bodyData: { alert_agree: number; marketing_agree: number };
7
+ }) => {
8
+ const VALID_VALUES = Array.from({ length: 16 }, (_, i) => i);
9
+ if (!VALID_VALUES.includes(bodyData.alert_agree) || !VALID_VALUES.includes(bodyData.marketing_agree)) {
10
+ return { result: false };
11
+ }
12
+
13
+ try {
14
+ const res = await Fetch(`/api/lawfirm/app/user/agree`, {
15
+ method: 'POST',
16
+ body: JSON.stringify(bodyData)
17
+ });
18
+ return await res;
19
+ } catch (e) {
20
+ console.error('Error sending number:', e);
21
+ return { result: false };
22
+ }
23
+ };
@@ -0,0 +1,5 @@
1
+ export declare const sendNumber: ({ bodyData }: {
2
+ bodyData: {
3
+ phoneNumber: string;
4
+ };
5
+ }) => Promise<any>;
@@ -0,0 +1,24 @@
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
+ import Fetch from '../_fetch/fetch';
11
+ export const sendNumber = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bodyData }) {
12
+ try {
13
+ const res = yield Fetch(`/api/lawfirm/app/auth/send-code`, {
14
+ method: 'POST',
15
+ body: JSON.stringify(bodyData)
16
+ });
17
+ console.log('res', res);
18
+ return res;
19
+ }
20
+ catch (e) {
21
+ console.error('Error sending number:', e);
22
+ throw e; // Rethrow for handling in the calling function
23
+ }
24
+ });
@@ -0,0 +1,15 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const sendNumber = async ({ bodyData }: { bodyData: { phoneNumber: string } }) => {
4
+ try {
5
+ const res = await Fetch(`/api/lawfirm/app/auth/send-code`, {
6
+ method: 'POST',
7
+ body: JSON.stringify(bodyData)
8
+ });
9
+ console.log('res', res);
10
+ return res;
11
+ } catch (e) {
12
+ console.error('Error sending number:', e);
13
+ throw e; // Rethrow for handling in the calling function
14
+ }
15
+ };
@@ -0,0 +1,2 @@
1
+ export declare const getToken: () => Promise<any>;
2
+ export declare const deleteToken: () => Promise<void>;
@@ -0,0 +1,33 @@
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 getToken = () => __awaiter(void 0, void 0, void 0, function* () {
11
+ try {
12
+ const result = yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
13
+ method: 'GET',
14
+ headers: {
15
+ 'Content-Type': 'application/json'
16
+ },
17
+ credentials: 'include'
18
+ }).then(obj => obj.json());
19
+ return result.token;
20
+ }
21
+ catch (e) {
22
+ return '';
23
+ }
24
+ });
25
+ export const deleteToken = () => __awaiter(void 0, void 0, void 0, function* () {
26
+ yield fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
27
+ method: 'DELETE',
28
+ headers: {
29
+ 'Content-Type': 'application/json'
30
+ },
31
+ credentials: 'include'
32
+ });
33
+ });
@@ -0,0 +1,25 @@
1
+ export const getToken = async () => {
2
+ try {
3
+ const result = await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
4
+ method: 'GET',
5
+ headers: {
6
+ 'Content-Type': 'application/json'
7
+ },
8
+ credentials: 'include'
9
+ }).then(obj => obj.json());
10
+
11
+ return result.token;
12
+ } catch (e) {
13
+ return '';
14
+ }
15
+ };
16
+
17
+ export const deleteToken = async () => {
18
+ await fetch(`${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}/api/auth/token`, {
19
+ method: 'DELETE',
20
+ headers: {
21
+ 'Content-Type': 'application/json'
22
+ },
23
+ credentials: 'include'
24
+ });
25
+ };
@@ -0,0 +1,6 @@
1
+ export declare const updateUserInfo: ({ bodyData }: {
2
+ bodyData: {
3
+ name?: string;
4
+ phoneNumber?: string;
5
+ };
6
+ }) => Promise<any>;
@@ -0,0 +1,26 @@
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
+ import Fetch from '../_fetch/fetch';
11
+ export const updateUserInfo = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bodyData }) {
12
+ // if(!bodyData.name || !bodyData.phoneNumber )
13
+ console.log('bodyData', bodyData);
14
+ try {
15
+ const res = yield Fetch(`/api/lawfirm/app/user`, {
16
+ method: 'PATCH',
17
+ body: JSON.stringify(bodyData)
18
+ });
19
+ console.log('res', res);
20
+ return res;
21
+ }
22
+ catch (e) {
23
+ console.error('Error sending number:', e);
24
+ throw e; // Rethrow for handling in the calling function
25
+ }
26
+ });
@@ -0,0 +1,17 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const updateUserInfo = async ({ bodyData }: { bodyData: { name?: string; phoneNumber?: string } }) => {
4
+ // if(!bodyData.name || !bodyData.phoneNumber )
5
+ console.log('bodyData', bodyData);
6
+ try {
7
+ const res = await Fetch(`/api/lawfirm/app/user`, {
8
+ method: 'PATCH',
9
+ body: JSON.stringify(bodyData)
10
+ });
11
+ console.log('res', res);
12
+ return res;
13
+ } catch (e) {
14
+ console.error('Error sending number:', e);
15
+ throw e; // Rethrow for handling in the calling function
16
+ }
17
+ };
@@ -0,0 +1,5 @@
1
+ export declare const withdraw: ({ bodyData }: {
2
+ bodyData: {
3
+ reason: string;
4
+ };
5
+ }) => Promise<any>;
@@ -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
+ import Fetch from '../_fetch/fetch';
11
+ export const withdraw = (_a) => __awaiter(void 0, [_a], void 0, function* ({ bodyData }) {
12
+ try {
13
+ const res = yield Fetch(`/api/lawfirm/app/user`, {
14
+ method: 'DELETE',
15
+ body: JSON.stringify(bodyData)
16
+ });
17
+ return res;
18
+ }
19
+ catch (e) {
20
+ console.error('Error sending number:', e);
21
+ throw e; // Rethrow for handling in the calling function
22
+ }
23
+ });
@@ -0,0 +1,14 @@
1
+ import Fetch from '../_fetch/fetch';
2
+
3
+ export const withdraw = async ({ bodyData }: { bodyData: { reason: string } }) => {
4
+ try {
5
+ const res = await Fetch(`/api/lawfirm/app/user`, {
6
+ method: 'DELETE',
7
+ body: JSON.stringify(bodyData)
8
+ });
9
+ return res;
10
+ } catch (e) {
11
+ console.error('Error sending number:', e);
12
+ throw e; // Rethrow for handling in the calling function
13
+ }
14
+ };
@@ -0,0 +1,2 @@
1
+ declare const Fetch: (url: string, options?: any) => Promise<any>;
2
+ export default Fetch;
@@ -0,0 +1,54 @@
1
+ 'use client';
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ // 로펌용
12
+ import { deleteToken } from '../_api/token';
13
+ const Fetch = (url_1, ...args_1) => __awaiter(void 0, [url_1, ...args_1], void 0, function* (url, options = {}) {
14
+ options = Object.assign(Object.assign({}, options), { credentials: 'include' });
15
+ options.headers = Object.assign(Object.assign({}, options.headers), { Accept: 'application/json;charset=UTF-8' });
16
+ if ((options === null || options === void 0 ? void 0 : options.method) === 'POST' && options.type !== 'form') {
17
+ options.headers['Content-Type'] = 'application/json;charset=UTF-8';
18
+ }
19
+ if ((options === null || options === void 0 ? void 0 : options.method) === 'POST' && options.type !== 'form') {
20
+ options.headers['Content-Type'] = 'application/json;charset=UTF-8';
21
+ }
22
+ else if ((options === null || options === void 0 ? void 0 : options.method) === 'PATCH') {
23
+ options.headers['Content-Type'] = 'application/json';
24
+ }
25
+ // console.log('options', options);
26
+ // console.log('url', url);
27
+ // const fullUrl = `${process.env.NEXT_PUBLIC_LAWFIRM_API}${url}`;
28
+ const fullUrl = `${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}${url}`;
29
+ // console.log('fullUrl', fullUrl);
30
+ try {
31
+ const result = yield fetch(fullUrl, options)
32
+ .then(item => {
33
+ return item.json();
34
+ })
35
+ .then(item => {
36
+ return item;
37
+ });
38
+ // 토큰 만료 메세지 날라오면 쿠키 지우고 홈으로 이동시키기
39
+ console.log('result', result);
40
+ if ((!result.result && result.message === 'Expired JWT') ||
41
+ result.message === 'Invalid JWT' ||
42
+ result.message === 'Expired JWT') {
43
+ yield deleteToken();
44
+ window.location.href = '/';
45
+ return;
46
+ }
47
+ return result;
48
+ }
49
+ catch (e) {
50
+ console.log(e);
51
+ throw e;
52
+ }
53
+ });
54
+ export default Fetch;
@@ -0,0 +1,58 @@
1
+ 'use client';
2
+ // 로펌용
3
+
4
+ import { deleteToken } from '../_api/token';
5
+
6
+ const Fetch = async (url: string, options: any = {}) => {
7
+ options = {
8
+ ...options,
9
+ credentials: 'include'
10
+ };
11
+ options.headers = {
12
+ ...options.headers,
13
+ Accept: 'application/json;charset=UTF-8'
14
+ };
15
+
16
+ if (options?.method === 'POST' && options.type !== 'form') {
17
+ options.headers['Content-Type'] = 'application/json;charset=UTF-8';
18
+ }
19
+
20
+ if (options?.method === 'POST' && options.type !== 'form') {
21
+ options.headers['Content-Type'] = 'application/json;charset=UTF-8';
22
+ } else if (options?.method === 'PATCH') {
23
+ options.headers['Content-Type'] = 'application/json';
24
+ }
25
+ // console.log('options', options);
26
+ // console.log('url', url);
27
+
28
+ // const fullUrl = `${process.env.NEXT_PUBLIC_LAWFIRM_API}${url}`;
29
+ const fullUrl = `${process.env.NEXT_PUBLIC_SERVICE_DOMAIN}${url}`;
30
+ // console.log('fullUrl', fullUrl);
31
+
32
+ try {
33
+ const result = await fetch(fullUrl, options)
34
+ .then(item => {
35
+ return item.json();
36
+ })
37
+ .then(item => {
38
+ return item;
39
+ });
40
+ // 토큰 만료 메세지 날라오면 쿠키 지우고 홈으로 이동시키기
41
+ console.log('result', result);
42
+ if (
43
+ (!result.result && result.message === 'Expired JWT') ||
44
+ result.message === 'Invalid JWT' ||
45
+ result.message === 'Expired JWT'
46
+ ) {
47
+ await deleteToken();
48
+ window.location.href = '/';
49
+ return;
50
+ }
51
+ return result;
52
+ } catch (e) {
53
+ console.log(e);
54
+ throw e;
55
+ }
56
+ };
57
+
58
+ export default Fetch;
@@ -0,0 +1,2 @@
1
+ declare const ServerFetch: (url: string, options?: any, cookies?: any) => Promise<any>;
2
+ export default ServerFetch;