naystack 1.5.35 → 1.5.36

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.
@@ -384,9 +384,9 @@ function AuthFetch() {
384
384
  {
385
385
  fetch: async () => {
386
386
  const cookie = await (0, import_headers3.cookies)();
387
- const token = cookie.get("refresh");
387
+ const token = cookie.get(REFRESH_COOKIE_NAME);
388
388
  if (!token) return null;
389
- return fetch(process.env.NEXT_PUBLIC_BACKEND_BASE_URL + `/email`, {
389
+ return fetch(getEnv("NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */), {
390
390
  credentials: "include",
391
391
  headers: {
392
392
  Cookie: cookie.toString()
@@ -351,9 +351,9 @@ function AuthFetch() {
351
351
  {
352
352
  fetch: async () => {
353
353
  const cookie = await cookies3();
354
- const token = cookie.get("refresh");
354
+ const token = cookie.get(REFRESH_COOKIE_NAME);
355
355
  if (!token) return null;
356
- return fetch(process.env.NEXT_PUBLIC_BACKEND_BASE_URL + `/email`, {
356
+ return fetch(getEnv("NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */), {
357
357
  credentials: "include",
358
358
  headers: {
359
359
  Cookie: cookie.toString()
@@ -37,12 +37,8 @@ var import_client2 = require("naystack/auth/email/client");
37
37
  var import_headers2 = require("next/headers");
38
38
  var import_react3 = __toESM(require("react"));
39
39
 
40
- // src/graphql/server.tsx
41
- var import_client = require("@apollo/client");
42
- var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
43
- var import_headers = require("next/headers");
44
- var import_react = __toESM(require("react"));
45
- var import_react2 = require("react");
40
+ // src/auth/constants.ts
41
+ var REFRESH_COOKIE_NAME = "refresh";
46
42
 
47
43
  // src/env.ts
48
44
  var getEnvValue = (key) => {
@@ -94,6 +90,11 @@ function getEnv(key, skipCheck) {
94
90
  }
95
91
 
96
92
  // src/graphql/server.tsx
93
+ var import_client = require("@apollo/client");
94
+ var import_client_integration_nextjs = require("@apollo/client-integration-nextjs");
95
+ var import_headers = require("next/headers");
96
+ var import_react = __toESM(require("react"));
97
+ var import_react2 = require("react");
97
98
  function Injector({
98
99
  fetch: fetch2,
99
100
  Component,
@@ -125,9 +126,9 @@ function AuthFetch() {
125
126
  {
126
127
  fetch: async () => {
127
128
  const cookie = await (0, import_headers2.cookies)();
128
- const token = cookie.get("refresh");
129
+ const token = cookie.get(REFRESH_COOKIE_NAME);
129
130
  if (!token) return null;
130
- return fetch(process.env.NEXT_PUBLIC_BACKEND_BASE_URL + `/email`, {
131
+ return fetch(getEnv("NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */), {
131
132
  credentials: "include",
132
133
  headers: {
133
134
  Cookie: cookie.toString()
@@ -3,16 +3,8 @@ import { AuthApply } from "naystack/auth/email/client";
3
3
  import { cookies as cookies2 } from "next/headers";
4
4
  import React2 from "react";
5
5
 
6
- // src/graphql/server.tsx
7
- import {
8
- ApolloClient,
9
- HttpLink,
10
- InMemoryCache
11
- } from "@apollo/client";
12
- import { registerApolloClient } from "@apollo/client-integration-nextjs";
13
- import { cookies } from "next/headers";
14
- import React from "react";
15
- import { Suspense } from "react";
6
+ // src/auth/constants.ts
7
+ var REFRESH_COOKIE_NAME = "refresh";
16
8
 
17
9
  // src/env.ts
18
10
  var getEnvValue = (key) => {
@@ -64,6 +56,15 @@ function getEnv(key, skipCheck) {
64
56
  }
65
57
 
66
58
  // src/graphql/server.tsx
59
+ import {
60
+ ApolloClient,
61
+ HttpLink,
62
+ InMemoryCache
63
+ } from "@apollo/client";
64
+ import { registerApolloClient } from "@apollo/client-integration-nextjs";
65
+ import { cookies } from "next/headers";
66
+ import React from "react";
67
+ import { Suspense } from "react";
67
68
  function Injector({
68
69
  fetch: fetch2,
69
70
  Component,
@@ -95,9 +96,9 @@ function AuthFetch() {
95
96
  {
96
97
  fetch: async () => {
97
98
  const cookie = await cookies2();
98
- const token = cookie.get("refresh");
99
+ const token = cookie.get(REFRESH_COOKIE_NAME);
99
100
  if (!token) return null;
100
- return fetch(process.env.NEXT_PUBLIC_BACKEND_BASE_URL + `/email`, {
101
+ return fetch(getEnv("NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */), {
101
102
  credentials: "include",
102
103
  headers: {
103
104
  Cookie: cookie.toString()
@@ -402,9 +402,9 @@ function AuthFetch() {
402
402
  {
403
403
  fetch: async () => {
404
404
  const cookie = await (0, import_headers3.cookies)();
405
- const token = cookie.get("refresh");
405
+ const token = cookie.get(REFRESH_COOKIE_NAME);
406
406
  if (!token) return null;
407
- return fetch(process.env.NEXT_PUBLIC_BACKEND_BASE_URL + `/email`, {
407
+ return fetch(getEnv("NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */), {
408
408
  credentials: "include",
409
409
  headers: {
410
410
  Cookie: cookie.toString()
@@ -363,9 +363,9 @@ function AuthFetch() {
363
363
  {
364
364
  fetch: async () => {
365
365
  const cookie = await cookies3();
366
- const token = cookie.get("refresh");
366
+ const token = cookie.get(REFRESH_COOKIE_NAME);
367
367
  if (!token) return null;
368
- return fetch(process.env.NEXT_PUBLIC_BACKEND_BASE_URL + `/email`, {
368
+ return fetch(getEnv("NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT" /* NEXT_PUBLIC_EMAIL_AUTH_ENDPOINT */), {
369
369
  credentials: "include",
370
370
  headers: {
371
371
  Cookie: cookie.toString()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "naystack",
3
- "version": "1.5.35",
3
+ "version": "1.5.36",
4
4
  "description": "A stack built with Next + GraphQL + S3 + Auth",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",