@mapomodule/utils 1.0.0-alpha.8 → 1.0.0

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/CHANGELOG.md CHANGED
@@ -3,6 +3,177 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [1.0.0](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.60...v1.0.0) (2026-07-02)
7
+
8
+ **Note:** Version bump only for package @mapomodule/utils
9
+
10
+
11
+
12
+
13
+
14
+ # [1.0.0-alpha.49](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.48...v1.0.0-alpha.49) (2023-07-27)
15
+
16
+
17
+ ### Features
18
+
19
+ * added max-depth prop to menu manager to give the possibility of set a limit in depth for nesting ([e4ab7a1](https://github.com/lotrekagency/mapo/commit/e4ab7a137cbb392e709e8865404105d7707a7634))
20
+
21
+
22
+
23
+
24
+
25
+ # [1.0.0-alpha.45](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.44...v1.0.0-alpha.45) (2023-06-10)
26
+
27
+
28
+ ### Bug Fixes
29
+
30
+ * fix setPointed ([f43685d](https://github.com/lotrekagency/mapo/commit/f43685dce23fb9383d7b0501767b1c40ff442686))
31
+
32
+
33
+
34
+
35
+
36
+ # [1.0.0-alpha.44](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.43...v1.0.0-alpha.44) (2023-06-10)
37
+
38
+
39
+ ### Bug Fixes
40
+
41
+ * added better reactivity to setPointed function ([78a4a88](https://github.com/lotrekagency/mapo/commit/78a4a88fbc98e5ce0d2662c074541eb4f8fd3ea1))
42
+
43
+
44
+ ### Performance Improvements
45
+
46
+ * EXPERIMENTAL: use Vue.set in setpointed and directly manipulate js object in FormField ([1c384e9](https://github.com/lotrekagency/mapo/commit/1c384e9d7c922b0e876512de874a3f9832ac30f1))
47
+
48
+
49
+
50
+
51
+
52
+ # [1.0.0-alpha.43](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.42...v1.0.0-alpha.43) (2023-02-02)
53
+
54
+
55
+ ### Bug Fixes
56
+
57
+ * put version on @mapomodule/utils ([9182283](https://github.com/lotrekagency/mapo/commit/9182283aeef7075a664ce12a45c94b934d5c491a))
58
+
59
+
60
+
61
+
62
+
63
+ # [1.0.0-alpha.40](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.39...v1.0.0-alpha.40) (2022-12-20)
64
+
65
+
66
+ ### Bug Fixes
67
+
68
+ * rewritten and more precise diffObjs function ([3e79775](https://github.com/lotrekagency/mapo/commit/3e797756d0dc48142febcdb806390552ea522b30))
69
+
70
+
71
+ ### Features
72
+
73
+ * style scrollbars ([48e4c7b](https://github.com/lotrekagency/mapo/commit/48e4c7b047a1062464d823ddeebdc60b96ea11a8))
74
+
75
+
76
+
77
+
78
+
79
+ # [1.0.0-alpha.34](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.33...v1.0.0-alpha.34) (2022-11-11)
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * fix draggable dialogues ([aeaa009](https://github.com/lotrekagency/mapo/commit/aeaa009cb30e4d13df1288d3996742d529713ffc))
85
+
86
+
87
+
88
+
89
+
90
+ # [1.0.0-alpha.30](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.29...v1.0.0-alpha.30) (2022-09-13)
91
+
92
+
93
+ ### Bug Fixes
94
+
95
+ * **auth:** removed js set cookie helpers since mapo login is http-only cookie based now ([6328c13](https://github.com/lotrekagency/mapo/commit/6328c13bec39d8e312f9dd4c33c53182fd64e6ed))
96
+
97
+
98
+ ### Features
99
+
100
+ * added memoized debounce ([3c9a025](https://github.com/lotrekagency/mapo/commit/3c9a02509ffd8277d362c30eb2cfafabdde995b7))
101
+
102
+
103
+
104
+
105
+
106
+ # [1.0.0-alpha.23](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.22...v1.0.0-alpha.23) (2022-05-04)
107
+
108
+
109
+ ### Bug Fixes
110
+
111
+ * **utils:** better File recognition for deepClone util ([72a1002](https://github.com/lotrekagency/mapo/commit/72a1002144ff0be1c016a39f46f8ea712a950825))
112
+
113
+
114
+
115
+
116
+
117
+ # [1.0.0-alpha.22](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.21...v1.0.0-alpha.22) (2022-05-01)
118
+
119
+
120
+ ### Features
121
+
122
+ * big code refactor and improovements to fields management ([a818d8b](https://github.com/lotrekagency/mapo/commit/a818d8b891dbb4892f50267d6355c41297e2c6c6))
123
+
124
+
125
+
126
+
127
+
128
+ # [1.0.0-alpha.15](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.14...v1.0.0-alpha.15) (2022-03-11)
129
+
130
+
131
+ ### Features
132
+
133
+ * enhance findPropPaths to deal also with arrays indexes ([158a9aa](https://github.com/lotrekagency/mapo/commit/158a9aa9329defbecbb39e1f19df2855dd3ece01))
134
+
135
+
136
+
137
+
138
+
139
+ # [1.0.0-alpha.13](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.12...v1.0.0-alpha.13) (2022-03-01)
140
+
141
+
142
+ ### Features
143
+
144
+ * make all modals draggable 🛸 ([57da10d](https://github.com/lotrekagency/mapo/commit/57da10d17aa31d58e55fda5385d45d43beed8c4f))
145
+
146
+
147
+
148
+
149
+
150
+ # [1.0.0-alpha.10](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.9...v1.0.0-alpha.10) (2022-02-11)
151
+
152
+
153
+ ### Bug Fixes
154
+
155
+ * fix objectHelper getPointed returning a keyerror when some point in path are missing ([6f1c2aa](https://github.com/lotrekagency/mapo/commit/6f1c2aa72176c9965e499135042de0646d9a04f8))
156
+
157
+
158
+ ### Features
159
+
160
+ * **core:** Completely rewritten multipart capabilities, now the crud helper autodiscovers whet to use a multipart request. ([0a6546c](https://github.com/lotrekagency/mapo/commit/0a6546c9adeaf1fcf57a88105101e476b8b786dc))
161
+
162
+
163
+
164
+
165
+
166
+ # [1.0.0-alpha.9](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.8...v1.0.0-alpha.9) (2022-02-08)
167
+
168
+
169
+ ### Bug Fixes
170
+
171
+ * **core:** fix object setPointed to create missing nesting ([7a26510](https://github.com/lotrekagency/mapo/commit/7a26510d6c1648156bd5a8f18d3851e4fe195d29))
172
+
173
+
174
+
175
+
176
+
6
177
  # [1.0.0-alpha.8](https://github.com/lotrekagency/mapo/compare/v1.0.0-alpha.7...v1.0.0-alpha.8) (2022-01-23)
7
178
 
8
179
 
@@ -0,0 +1,12 @@
1
+ function setScrollbarTrackColor(dark) {
2
+ document
3
+ ?.querySelector(":root")
4
+ .style.setProperty(
5
+ "--v-scrollbar-track-color",
6
+ dark ? "#1E1E1E" : "#f5f5f5"
7
+ );
8
+ }
9
+
10
+ module.exports = {
11
+ setScrollbarTrackColor,
12
+ };
@@ -0,0 +1,68 @@
1
+ const pad = (val, len = 2) => String(val).padStart(len, "0");
2
+ const convertToDate = (date) =>
3
+ typeof date == "string" ? new Date(date) : date;
4
+
5
+ function getUTC(date) {
6
+ return new Date(date.toISOString().slice(0, -1));
7
+ }
8
+
9
+ function cleanDateStr(dateStr) {
10
+ return dateStr &&
11
+ !dateStr.endsWith("Z") &&
12
+ dateStr.slice(-6).indexOf("+") === -1 &&
13
+ dateStr.slice(-6).indexOf("-") === -1
14
+ ? dateStr + "Z"
15
+ : dateStr;
16
+ }
17
+
18
+ function formatLocalTime(date) {
19
+ return `${pad(date.getHours())}:${pad(date.getMinutes())}:${pad(
20
+ date.getSeconds()
21
+ )}`;
22
+ }
23
+
24
+ function formatLocalDate(date) {
25
+ return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(
26
+ date.getDate()
27
+ )}`;
28
+ }
29
+
30
+ function formatLocalDateTime(date) {
31
+ return `${formatLocalDate(date)}T${formatLocalTime(date)}`;
32
+ }
33
+
34
+ function formatUTCTime(date) {
35
+ return formatLocalTime(getUTC(date));
36
+ }
37
+
38
+ function formatUTCDate(date) {
39
+ return formatLocalDate(getUTC(date));
40
+ }
41
+
42
+ const formatOps = Object.fromEntries(
43
+ Object.entries({
44
+ getUTC,
45
+ formatLocalTime,
46
+ formatLocalDate,
47
+ formatLocalDateTime,
48
+ formatUTCTime,
49
+ formatUTCDate
50
+ }).map(([k, func]) => [k, (date) => func(convertToDate(date))])
51
+ );
52
+
53
+ function mergeDate(dateTime, date) {
54
+ let newDateTime = new Date(dateTime);
55
+ date = convertToDate(date);
56
+ newDateTime.setFullYear(date.getFullYear());
57
+ newDateTime.setMonth(date.getMonth());
58
+ newDateTime.setDate(date.getDate());
59
+ return newDateTime;
60
+ }
61
+
62
+ function mergeTime(dateTime, time) {
63
+ let newDateTime = new Date(dateTime);
64
+ let timeDateTime = new Date(`2000-01-01T${time}`);
65
+ return mergeDate(timeDateTime, newDateTime);
66
+ }
67
+
68
+ module.exports = { ...formatOps, cleanDateStr, mergeDate, mergeTime };
@@ -1,7 +1,8 @@
1
1
  function debounce(func, wait, immediate) {
2
2
  var timeout;
3
3
  return function () {
4
- var context = this, args = arguments;
4
+ var context = this,
5
+ args = arguments;
5
6
  var later = function () {
6
7
  timeout = null;
7
8
  if (!immediate) func.apply(context, args);
@@ -11,8 +12,31 @@ function debounce(func, wait, immediate) {
11
12
  timeout = setTimeout(later, wait);
12
13
  if (callNow) func.apply(context, args);
13
14
  };
14
- };
15
+ }
16
+
17
+ function memoizedDebounce(
18
+ func,
19
+ wait,
20
+ immediate,
21
+ argsSerializer = (args) => JSON.stringify(args)
22
+ ) {
23
+ var timeout = {};
24
+ return function () {
25
+ var context = this,
26
+ args = arguments,
27
+ serializedArgs = argsSerializer(arguments);
28
+ var later = function () {
29
+ timeout[serializedArgs] = null;
30
+ if (!immediate) func.apply(context, args);
31
+ };
32
+ var callNow = immediate && !timeout[serializedArgs];
33
+ clearTimeout(timeout[serializedArgs]);
34
+ timeout[serializedArgs] = setTimeout(later, wait);
35
+ if (callNow) func.apply(context, args);
36
+ };
37
+ }
15
38
 
16
39
  module.exports = {
17
- debounce
18
- }
40
+ debounce,
41
+ memoizedDebounce,
42
+ };
@@ -20,8 +20,33 @@ function humanFileSize(bytes, si = false, dp = 1) {
20
20
  );
21
21
 
22
22
  return bytes.toFixed(dp) + " " + units[u];
23
- }
23
+ };
24
+
25
+ function slugify(str) {
26
+ str = str || "";
27
+ str = str.replace(/^\s+|\s+$/g, ''); // trim
28
+ str = str.toLowerCase();
29
+
30
+ // remove accents, swap ñ for n, etc
31
+ var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
32
+ var to = "aaaaeeeeiiiioooouuuunc------";
33
+ for (var i = 0, l = from.length; i < l; i++) {
34
+ str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
35
+ }
36
+
37
+ str = str.replace(/[^a-z0-9 -]/g, '') // remove invalid chars
38
+ .replace(/\s+/g, '-') // collapse whitespace and replace by -
39
+ .replace(/-+/g, '-'); // collapse dashes
40
+
41
+ return str;
42
+ };
43
+
44
+ function titleCase(string) {
45
+ return (string && string[0].toUpperCase() + string.slice(1).toLowerCase()) || "";
46
+ };
24
47
 
25
48
  module.exports = {
26
- humanFileSize
49
+ humanFileSize,
50
+ slugify,
51
+ titleCase,
27
52
  }
@@ -0,0 +1,15 @@
1
+ function calcMaxMenuNestDepth(node, currentDepth = 0) {
2
+ if (!node?.nodes || node?.nodes?.length === 0) {
3
+ return currentDepth;
4
+ }
5
+ let maxDepth = currentDepth;
6
+ for (const childNode of node.nodes) {
7
+ const childDepth = calcMaxMenuNestDepth(childNode, currentDepth + 1);
8
+ maxDepth = Math.max(maxDepth, childDepth);
9
+ }
10
+ return maxDepth;
11
+ }
12
+
13
+ module.exports = {
14
+ calcMaxMenuNestDepth
15
+ }
@@ -1,7 +1,10 @@
1
+ var Vue = require('vue')
2
+ Vue = Vue.default || Vue
3
+
1
4
  function deepClone(obj) {
2
5
  const clone = obj instanceof Array ? Object.assign([]) : Object.assign({});
3
6
  for (const i in obj) {
4
- if (obj[i] != null && typeof (obj[i]) == 'object' && !(obj[i] instanceof File) && !(obj[i] instanceof Date)) {
7
+ if (obj[i] != null && typeof (obj[i]) == 'object' && !(isFileOrBlob(obj[i])) && !(obj[i] instanceof Date)) {
5
8
  clone[i] = deepClone(obj[i]);
6
9
  } else {
7
10
  clone[i] = obj[i];
@@ -11,17 +14,18 @@ function deepClone(obj) {
11
14
  }
12
15
 
13
16
  function getPointed(obj, kpointed, def) {
14
- const result = kpointed.split(".").reduce((o, k) => typeof (o) == 'object' ? o[k] : o, obj)
17
+ const result = kpointed.split(".").reduce((o, k) => typeof (o) == 'object' ? (o || {})[k] : o, obj)
15
18
  return result === undefined ? def : result
16
19
  }
17
20
 
18
21
  function setPointed(obj, kpointed, val) {
19
22
  const arr = typeof kpointed == 'string' ? kpointed.split(".") : kpointed
20
23
  if (arr.length == 1) {
21
- obj[arr[0]] = val
24
+ Vue.set(obj, arr[0], val)
22
25
  return obj
23
26
  }
24
- return setPointed(obj[arr[0]] || {}, arr.slice(1), val)
27
+ Vue.set(obj, arr[0], obj[arr[0]] || {})
28
+ return setPointed(obj[arr[0]], arr.slice(1), val)
25
29
  }
26
30
 
27
31
  function filterObj(obj, kpointedArr) {
@@ -30,17 +34,74 @@ function filterObj(obj, kpointedArr) {
30
34
  return acc
31
35
  }, {})
32
36
  }
33
- function diffObjs(obj1, obj2) {
34
- const a = deepClone(obj1)
35
- const b = deepClone(obj2)
36
- for (const i in b){
37
- if (JSON.stringify(a[i]) === JSON.stringify(b[i])){
38
- delete b[i]
39
- } else if (!Array.isArray(b[i]) && typeof b[i] == 'object') {
40
- b[i] = diffObjs(a[i], b[i])
37
+
38
+ function isFileInstance(input) {
39
+ if ('File' in window && input instanceof File)
40
+ return true;
41
+ else return false;
42
+ }
43
+
44
+ function isBlobInstance(input) {
45
+ if ('Blob' in window && input instanceof Blob)
46
+ return true;
47
+ else return false;
48
+ }
49
+
50
+ function isFileOrBlob(input) {
51
+ return isFileInstance(input) || isBlobInstance(input)
52
+ }
53
+
54
+ function filesInObject(obj) {
55
+ return findPropPaths(obj, ({ val }) => isFileOrBlob(val))
56
+ }
57
+
58
+ function findPropPaths(obj, predicate) {
59
+ const discoveredObjects = [];
60
+ const path = [];
61
+ const results = [];
62
+ if (!obj && (typeof obj !== "object" || Array.isArray(obj))) {
63
+ throw new TypeError("First argument of findPropPaths is not the correct type Object");
64
+ }
65
+ if (typeof predicate !== "function") {
66
+ throw new TypeError("Predicate is not a function");
67
+ }
68
+ (function find(obj) {
69
+ for (const key in obj) {
70
+ if (predicate({ val: obj[key], obj, path, key }) === true) {
71
+ path.push(key);
72
+ results.push(path.join("."));
73
+ path.pop();
74
+ }
75
+ const o = obj[key];
76
+ if (o && typeof o === "object") {
77
+ if (!discoveredObjects.find(obj => obj === o)) {
78
+ path.push(key);
79
+ discoveredObjects.push(o);
80
+ find(o);
81
+ path.pop();
82
+ }
83
+ }
41
84
  }
85
+ }(obj));
86
+ return results;
87
+ }
88
+
89
+ function diffObjs(obj1, obj2, clone=deepClone) {
90
+ const a = obj1 && clone(obj1) || obj2 && obj2.__proto__.constructor();
91
+ const b = obj2 && clone(obj2) || obj1 && obj1.__proto__.constructor();
92
+ for (const i in b) {
93
+ if (JSON.stringify(a[i]) === JSON.stringify(b[i])) {
94
+ delete b[i];
95
+ } else if (b[i] && !Array.isArray(b[i]) && typeof b[i] == 'object') {
96
+ const diff = diffObjs(a[i], b[i], (v) => v);
97
+ if (diff !== undefined){
98
+ b[i] = diff;
99
+ } else {
100
+ delete b[i];
101
+ };
102
+ };
42
103
  }
43
- return b;
104
+ return b && Object.keys(b).length ? b : undefined;
44
105
  }
45
106
 
46
107
  module.exports = {
@@ -48,5 +109,10 @@ module.exports = {
48
109
  getPointed,
49
110
  setPointed,
50
111
  filterObj,
112
+ isFileInstance,
113
+ isBlobInstance,
114
+ isFileOrBlob,
115
+ filesInObject,
116
+ findPropPaths,
51
117
  diffObjs
52
- }
118
+ }
@@ -0,0 +1,9 @@
1
+ function nameSpacedSlots(slots, scope) {
2
+ return Object.keys(slots)
3
+ .filter((name) => name.startsWith(scope))
4
+ .map((name) => name.replace(scope, ""));
5
+ }
6
+
7
+ module.exports = {
8
+ nameSpacedSlots
9
+ }
package/index.js CHANGED
@@ -2,10 +2,12 @@ const auth = require('./helpers/auth');
2
2
  const debounce = require('./helpers/debounce');
3
3
  const formatters = require('./helpers/formatters');
4
4
  const objHelpers = require('./helpers/objHelpers');
5
+ const VDraggableModals = require('./plugins/v-draggable-modals');
5
6
 
6
7
  module.exports = {
7
8
  auth,
8
9
  debounce,
9
10
  formatters,
10
- objHelpers
11
+ objHelpers,
12
+ VDraggableModals,
11
13
  }
package/package.json CHANGED
@@ -1,16 +1,13 @@
1
1
  {
2
2
  "name": "@mapomodule/utils",
3
- "version": "1.0.0-alpha.8",
3
+ "version": "1.0.0",
4
4
  "license": "MIT",
5
5
  "description": "This is part of Mapo nuxt module. Provides a set of utils for the project.",
6
6
  "author": "bnznamco <gabriele.baldi.01@gmail.com>",
7
7
  "repository": "https://github.com/lotrekagency/mapo",
8
8
  "main": "./index.js",
9
- "dependencies": {
10
- "js-cookie": "^2.2.1"
11
- },
12
9
  "publishConfig": {
13
10
  "access": "public"
14
11
  },
15
- "gitHead": "4448ce925e9f3af25f78f86c3e28a88145201520"
12
+ "gitHead": "1e825711fb068d6195fe6dda607d1fb0e05109ec"
16
13
  }
@@ -0,0 +1,39 @@
1
+ module.exports = function () {
2
+ const d = {};
3
+ document.addEventListener("mousedown", e => {
4
+ const closestDialog = e.target.closest(".v-dialog.v-dialog--active");
5
+ if (e.button === 0 && closestDialog != null && closestDialog.querySelector(".v-card__title")?.contains(e.target)) {
6
+ d.el = closestDialog;
7
+ d.mouseStartX = e.clientX;
8
+ d.mouseStartY = e.clientY;
9
+ d.elStartX = d.el.getBoundingClientRect().left;
10
+ d.elStartY = d.el.getBoundingClientRect().top;
11
+ d.el.style.position = "fixed";
12
+ d.el.style.margin = 0;
13
+ d.oldTransition = d.el.style.transition;
14
+ d.el.style.transition = "none"
15
+ }
16
+ });
17
+ document.addEventListener("mousemove", e => {
18
+ if (d.el === undefined) return;
19
+ d.el.style.left = Math.min(
20
+ Math.max(d.elStartX + e.clientX - d.mouseStartX, 0),
21
+ window.innerWidth - d.el.getBoundingClientRect().width
22
+ ) + "px";
23
+ d.el.style.top = Math.min(
24
+ Math.max(d.elStartY + e.clientY - d.mouseStartY, 0),
25
+ window.innerHeight - d.el.getBoundingClientRect().height
26
+ ) + "px";
27
+ });
28
+ document.addEventListener("mouseup", () => {
29
+ if (d.el === undefined) return;
30
+ d.el.style.transition = d.oldTransition;
31
+ d.el = undefined
32
+ });
33
+ setInterval(() => {
34
+ const dialog = document.querySelector(".v-dialog.v-dialog--active");
35
+ if (dialog === null) return;
36
+ dialog.style.left = Math.min(parseInt(dialog.style.left), window.innerWidth - dialog.getBoundingClientRect().width) + "px";
37
+ dialog.style.top = Math.min(parseInt(dialog.style.top), window.innerHeight - dialog.getBoundingClientRect().height) + "px";
38
+ }, 100);
39
+ }
package/LICENSE.md DELETED
@@ -1,20 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) Lotrek 2021
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
package/helpers/auth.js DELETED
@@ -1,21 +0,0 @@
1
- const Cookies = require('js-cookie')
2
-
3
- const TokenKey = '__mapo_session'
4
-
5
- function getToken() {
6
- return Cookies.get(TokenKey)
7
- }
8
-
9
- function setToken(token) {
10
- return Cookies.set(TokenKey, token)
11
- }
12
-
13
- function removeToken() {
14
- return Cookies.remove(TokenKey)
15
- }
16
-
17
- module.exports = {
18
- getToken,
19
- setToken,
20
- removeToken
21
- }