@nitra/cap 1.0.9 → 1.1.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/cap",
3
- "version": "1.0.9",
3
+ "version": "1.1.1",
4
4
  "description": "Nitra capacitor components",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -9,7 +9,7 @@ import { initializeApp } from 'firebase/app'
9
9
  */
10
10
  export async function saveToken() {
11
11
  try {
12
- if (localStorage.getItem('pushToken')) {
12
+ if (localStorage.getItem(`pushToken_${import.meta.env.VITE_APP}`)) {
13
13
  console.log('Push Token is already exists.')
14
14
 
15
15
  return
@@ -81,6 +81,8 @@ async function getWebPushToken() {
81
81
  * @returns {Promise<void>}
82
82
  */
83
83
  async function sendTokenToServer(pushToken) {
84
+ console.log(`pushToken=====${pushToken}`)
85
+
84
86
  const response = await fetch('/n-push/save-user', {
85
87
  method: 'POST',
86
88
  headers: {
@@ -94,7 +96,9 @@ async function sendTokenToServer(pushToken) {
94
96
  })
95
97
  })
96
98
 
99
+ console.log(response)
100
+
97
101
  if (response.ok) {
98
- localStorage.setItem('pushToken', pushToken)
102
+ localStorage.setItem(`pushToken_${import.meta.env.VITE_APP}`, pushToken)
99
103
  }
100
104
  }