npm-pkg-hook 1.1.8 → 1.1.9
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/.github/pull_request_template.md +17 -17
- package/.github/workflows/pepeline.yaml +29 -29
- package/package.json +1 -1
- package/script.txt +6 -6
- package/src/hooks/getSession/index.js +1 -1
- package/src/hooks/useCart/useCart/index.js +4 -4
- package/src/hooks/useLocationNavigate/index.js +54 -54
- package/src/hooks/useLogout/index.js +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
## What problem is this solving?
|
|
2
|
-
|
|
3
|
-
- [x] this is an example if you finish your work
|
|
4
|
-
|
|
5
|
-
## How should this be manually tested?
|
|
6
|
-
|
|
7
|
-
### Screenshots or example usage
|
|
8
|
-
|
|
9
|
-
## Types of changes
|
|
10
|
-
|
|
11
|
-
* [ ] Bug fix (a non-breaking change which fixes an issue)
|
|
12
|
-
* [ ] New feature (a non-breaking change which adds functionality)
|
|
13
|
-
* [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
14
|
-
* [ ] Requires change to documentation, which has been updated accordingly.
|
|
15
|
-
|
|
16
|
-
## PR's related
|
|
17
|
-
|
|
1
|
+
## What problem is this solving?
|
|
2
|
+
|
|
3
|
+
- [x] this is an example if you finish your work
|
|
4
|
+
|
|
5
|
+
## How should this be manually tested?
|
|
6
|
+
|
|
7
|
+
### Screenshots or example usage
|
|
8
|
+
|
|
9
|
+
## Types of changes
|
|
10
|
+
|
|
11
|
+
* [ ] Bug fix (a non-breaking change which fixes an issue)
|
|
12
|
+
* [ ] New feature (a non-breaking change which adds functionality)
|
|
13
|
+
* [ ] Breaking change (fix or feature that would cause existing functionality to change)
|
|
14
|
+
* [ ] Requires change to documentation, which has been updated accordingly.
|
|
15
|
+
|
|
16
|
+
## PR's related
|
|
17
|
+
|
|
18
18
|
- [x] Add the relation between pull request
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
name: Publish package to GitHub Packages
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches: [main]
|
|
5
|
-
pull_request:
|
|
6
|
-
branches: [develop]
|
|
7
|
-
types: [opened, synchronize]
|
|
8
|
-
release:
|
|
9
|
-
types: [created]
|
|
10
|
-
jobs:
|
|
11
|
-
build:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
permissions:
|
|
14
|
-
contents: read
|
|
15
|
-
packages: write
|
|
16
|
-
steps:
|
|
17
|
-
- uses: actions/checkout@v3
|
|
18
|
-
# Setup .npmrc file to publish to GitHub Packages
|
|
19
|
-
- uses: actions/setup-node@v3
|
|
20
|
-
with:
|
|
21
|
-
node-version: '16.x'
|
|
22
|
-
registry-url: 'https://npm.pkg.github.com'
|
|
23
|
-
# Defaults to the user or organization that owns the workflow file
|
|
24
|
-
- run: npm install
|
|
25
|
-
- uses: JS-DevTools/npm-publish@v1
|
|
26
|
-
with:
|
|
27
|
-
token: ${{ secrets.NPM_TOKEN }}
|
|
28
|
-
# - run: npm publish
|
|
29
|
-
# env:
|
|
1
|
+
name: Publish package to GitHub Packages
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
branches: [develop]
|
|
7
|
+
types: [opened, synchronize]
|
|
8
|
+
release:
|
|
9
|
+
types: [created]
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
permissions:
|
|
14
|
+
contents: read
|
|
15
|
+
packages: write
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
# Setup .npmrc file to publish to GitHub Packages
|
|
19
|
+
- uses: actions/setup-node@v3
|
|
20
|
+
with:
|
|
21
|
+
node-version: '16.x'
|
|
22
|
+
registry-url: 'https://npm.pkg.github.com'
|
|
23
|
+
# Defaults to the user or organization that owns the workflow file
|
|
24
|
+
- run: npm install
|
|
25
|
+
- uses: JS-DevTools/npm-publish@v1
|
|
26
|
+
with:
|
|
27
|
+
token: ${{ secrets.NPM_TOKEN }}
|
|
28
|
+
# - run: npm publish
|
|
29
|
+
# env:
|
|
30
30
|
# NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
package/package.json
CHANGED
package/script.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// (function (params) {
|
|
2
|
-
// var ct = document.createElement('link');
|
|
3
|
-
// ct.rel = 'stylesheet';
|
|
4
|
-
// ct.href = 'https://csswizardry.com/ct/ct.css';
|
|
5
|
-
// ct.classList.add('ct');
|
|
6
|
-
// document.head.appendChild(ct)
|
|
1
|
+
// (function (params) {
|
|
2
|
+
// var ct = document.createElement('link');
|
|
3
|
+
// ct.rel = 'stylesheet';
|
|
4
|
+
// ct.href = 'https://csswizardry.com/ct/ct.css';
|
|
5
|
+
// ct.classList.add('ct');
|
|
6
|
+
// document.head.appendChild(ct)
|
|
7
7
|
// }());
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const getSession = async () => {
|
|
2
2
|
try {
|
|
3
|
-
const res = await fetch(`${process.env.URL_BASE}api/auth/getAuth`,
|
|
3
|
+
const res = await fetch(`${process.env.URL_BASE}/api/auth/getAuth`,
|
|
4
4
|
{ method: 'GET', headers: { 'Content-Type': 'application/json' } })
|
|
5
5
|
const data = await res.json()
|
|
6
6
|
const { ok, ok: { user }, isSession } = data || {}
|
|
@@ -316,15 +316,15 @@ export const useCart = ({
|
|
|
316
316
|
if (!idStore) {
|
|
317
317
|
return
|
|
318
318
|
}
|
|
319
|
-
|
|
319
|
+
const isExistItemInShoppingCart = dataShoppingCard?.find((item) => {
|
|
320
|
+
return item?.productFood && item?.productFood?.pId === food.pId
|
|
321
|
+
}) ?? null
|
|
322
|
+
if (!isExistItemInShoppingCart) handleMenu(1)
|
|
320
323
|
const filteredDataOptional = filterDataOptional(dataOptional)
|
|
321
324
|
|
|
322
325
|
const dataExtraFiltered = filterExtra(dataExtra)
|
|
323
326
|
|
|
324
327
|
const refCodePid = RandomCode(20)
|
|
325
|
-
const isExistItemInShoppingCart = dataShoppingCard?.find((item) => {
|
|
326
|
-
return item?.productFood && item?.productFood?.pId === food.pId
|
|
327
|
-
}) ?? null
|
|
328
328
|
|
|
329
329
|
console.log(isExistItemInShoppingCart)
|
|
330
330
|
const idShoppingCart = isExistItemInShoppingCart?.ShoppingCard
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
const defaultSettings = {
|
|
4
|
-
enableHighAccuracy: false,
|
|
5
|
-
timeout: Infinity,
|
|
6
|
-
maximumAge: 0
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const usePosition = (watch = false, settings = defaultSettings) => {
|
|
10
|
-
const [position, setPosition] = useState({})
|
|
11
|
-
const [error, setError] = useState(null)
|
|
12
|
-
|
|
13
|
-
const onChange = ({ coords, timestamp }) => {
|
|
14
|
-
setPosition({
|
|
15
|
-
latitude: coords.latitude,
|
|
16
|
-
longitude: coords.longitude,
|
|
17
|
-
accuracy: coords.accuracy,
|
|
18
|
-
speed: coords.speed,
|
|
19
|
-
timestamp
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const onError = () => {
|
|
24
|
-
setError(error?.message)
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!navigator || !navigator.geolocation) {
|
|
29
|
-
setError('Geolocation is not supported')
|
|
30
|
-
return
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
let watcher = null
|
|
34
|
-
if (watch) {
|
|
35
|
-
watcher = navigator.geolocation.watchPosition(
|
|
36
|
-
onChange,
|
|
37
|
-
onError,
|
|
38
|
-
settings
|
|
39
|
-
)
|
|
40
|
-
} else {
|
|
41
|
-
navigator.geolocation.getCurrentPosition(onChange, onError, settings)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return () => { return watcher && navigator.geolocation.clearWatch(watcher) }
|
|
45
|
-
}, [
|
|
46
|
-
settings,
|
|
47
|
-
settings.enableHighAccuracy,
|
|
48
|
-
settings.timeout,
|
|
49
|
-
settings.maximumAge,
|
|
50
|
-
watch
|
|
51
|
-
])
|
|
52
|
-
|
|
53
|
-
return { ...position, error }
|
|
54
|
-
}
|
|
1
|
+
import { useEffect, useState } from 'react'
|
|
2
|
+
|
|
3
|
+
const defaultSettings = {
|
|
4
|
+
enableHighAccuracy: false,
|
|
5
|
+
timeout: Infinity,
|
|
6
|
+
maximumAge: 0
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const usePosition = (watch = false, settings = defaultSettings) => {
|
|
10
|
+
const [position, setPosition] = useState({})
|
|
11
|
+
const [error, setError] = useState(null)
|
|
12
|
+
|
|
13
|
+
const onChange = ({ coords, timestamp }) => {
|
|
14
|
+
setPosition({
|
|
15
|
+
latitude: coords.latitude,
|
|
16
|
+
longitude: coords.longitude,
|
|
17
|
+
accuracy: coords.accuracy,
|
|
18
|
+
speed: coords.speed,
|
|
19
|
+
timestamp
|
|
20
|
+
})
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const onError = () => {
|
|
24
|
+
setError(error?.message)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (!navigator || !navigator.geolocation) {
|
|
29
|
+
setError('Geolocation is not supported')
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
let watcher = null
|
|
34
|
+
if (watch) {
|
|
35
|
+
watcher = navigator.geolocation.watchPosition(
|
|
36
|
+
onChange,
|
|
37
|
+
onError,
|
|
38
|
+
settings
|
|
39
|
+
)
|
|
40
|
+
} else {
|
|
41
|
+
navigator.geolocation.getCurrentPosition(onChange, onError, settings)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return () => { return watcher && navigator.geolocation.clearWatch(watcher) }
|
|
45
|
+
}, [
|
|
46
|
+
settings,
|
|
47
|
+
settings.enableHighAccuracy,
|
|
48
|
+
settings.timeout,
|
|
49
|
+
settings.maximumAge,
|
|
50
|
+
watch
|
|
51
|
+
])
|
|
52
|
+
|
|
53
|
+
return { ...position, error }
|
|
54
|
+
}
|
|
@@ -12,7 +12,7 @@ export const useLogout = ({ setAlertBox = () => { } } = {}) => {
|
|
|
12
12
|
const onClickLogout = async () => {
|
|
13
13
|
setLoading(true)
|
|
14
14
|
await window
|
|
15
|
-
.fetch(`${process.env.URL_BASE}api/auth/logout/`, {})
|
|
15
|
+
.fetch(`${process.env.URL_BASE}/api/auth/logout/`, {})
|
|
16
16
|
.then(res => {
|
|
17
17
|
if (res) {
|
|
18
18
|
localStorage.removeItem('session')
|