PageSourceSearch

https://spp.kr/resources/js/libs/axios/axiosSetup.js

js spp.kr collected 2026-10-08 10:26:37 UTC 3,069 bytes, 87 lines download raw bytes

1const validate = (stat) => {
2  return stat >= 200 && stat < 300; // default
3}
4
5axios.interceptors.request.use(
6  function (config) {
7    config.baseURL = localStorage.getItem('platformApi');
8    config.timeout = 600000;
9
10    const token = sessionStorage.getItem('token');
11
12    if (token !== null || token !== "" || token !== undefined) {
13        config.headers.common['Authorization'] = token;
14    }
15
16    let checkSiteId = sessionStorage.getItem('siteId');
17    let tenantId	= "ezpmp_" + checkSiteId;
18    
19    
20    let urlString = window.location.href;
21    let checkCommonSetting = config.url;
22    if(urlString.indexOf('o2meet-g.kr') != -1){
23    	config.headers.common['x-tenant-id'] = tenantId;
24    	if(checkCommonSetting.indexOf('/config/') != -1){ // tb_site_info_config 관련 API
25    		config.headers.common['x-tenant-id'] = "ezpmp_platform";
26    	}
27    }else{
28    	config.headers.common['x-tenant-id'] = "ezpmp_platform";
29    }
30    // config.headers.common['Cache-Control'] = 'no-cache';
31    // config.headers.common['Pragma'] = 'no-cache';
32    // config.headers.common['Expires'] = '0';
33    config.headers.common['Content-Type'] = 'application/json';
34    config.headers.common['Access-Control-Allow-Origin'] = '*';
35    config.headers.common['Access-Control-Allow-Methods'] = 'GET,POST';
36
37    // config.headers.common['access-control-allow-headers-response-header'] = 'X-Requested-With, Authorization, Content-Type, Accept, apikey';
38
39    config.withCredentials = false;
40    config.responseEncoding = 'utf-8';
41    config.validateStatus = validate;
42    return config;
43  },
44  function (error) {
45    ezpmpcommonUtil.log.log(error.response);
46    return Promise.reject(error);
47  });
48
49axios.interceptors.response.use(
50  function (response) {
51    return response;
52  },
53  function (error) {
54    const errorData = error.response.data;
55    const httpStatus = errorData.httpStatus;
56    // switch (httpStatus) {
57    //   case 401: // 로그인을 안한 경우 보여줄 페이지
58    //     location.href = '';
59    //     break;
60    //   case 403: // 페이지에 권한이 없는 경우 보여줄 페이지
61    //     location.href = '';
62    //     break;
63    // }
64    const msg = `Status: ${httpStatus}, Error: ${errorData.errorMessage}, Detail: ${errorData.detailMessage}`;
65    console.error('Error>', msg);
66    return Promise.reject(error);
67  });
68
69const reValue = (val) => {
70  return val.value === '' ? null : val.value;
71}
72
73const reObjValue = (elements) => {
74  const keys = Object.keys(elements);
75  keys.forEach(key => {
76    console.log(`${key}: ${JSON.stringify(elements[key])}`);
77    if(key === 'lastMobileNo' || key === 'lastNumber') {
78      elements[key] = elements[key] === '' || elements[key] === null ? null : elements[key].replaceAll("-","");
79    } else if(key === 'lastTelNo') {
80      elements[key] = elements[key].replaceAll("-","");
81    }
82    else {
83      elements[key] = elements[key] === '' || elements[key] === null ? null : elements[key];
84    }
85  });
86  return elements;
87}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.