eddev 0.2.2 → 0.2.3
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.
|
@@ -126,14 +126,11 @@ function createNextApp(opts) {
|
|
|
126
126
|
"components/**/*",
|
|
127
127
|
"hooks/**/*",
|
|
128
128
|
"queries/**/*",
|
|
129
|
-
".env",
|
|
130
129
|
"views/**/*",
|
|
131
|
-
"theme.css.tsx",
|
|
132
|
-
"types.graphql.ts",
|
|
133
|
-
"types.views.ts",
|
|
134
|
-
"types.blocks.ts",
|
|
135
|
-
"types.api.ts",
|
|
136
130
|
"utils/**/*",
|
|
131
|
+
".env",
|
|
132
|
+
"*.ts",
|
|
133
|
+
"*.tsx",
|
|
137
134
|
"ed.config.json",
|
|
138
135
|
])
|
|
139
136
|
// Also sync APIs into the APIs folder
|
package/package.json
CHANGED
|
@@ -42,8 +42,18 @@ export async function fetchWordpressProps(pathname: string) {
|
|
|
42
42
|
return url
|
|
43
43
|
})
|
|
44
44
|
|
|
45
|
+
const payload = JSON.parse(text)
|
|
46
|
+
|
|
47
|
+
if (payload.redirect) {
|
|
48
|
+
return {
|
|
49
|
+
status: payload.code,
|
|
50
|
+
redirect: true,
|
|
51
|
+
uri: payload.redirect,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
45
55
|
return {
|
|
46
56
|
status: response.status,
|
|
47
|
-
data:
|
|
57
|
+
data: payload,
|
|
48
58
|
}
|
|
49
59
|
}
|
|
@@ -14,10 +14,18 @@ export async function getStaticPaths(): Promise<GetStaticPathsResult> {
|
|
|
14
14
|
|
|
15
15
|
export async function getStaticProps({ params }: GetStaticPropsContext): Promise<GetStaticPropsResult<any>> {
|
|
16
16
|
const result = await fetchWordpressProps((params?.slug as string[]).join("/"))
|
|
17
|
+
console.log("RESULT", result)
|
|
17
18
|
if (result.status === 404) {
|
|
18
19
|
return {
|
|
19
20
|
notFound: true,
|
|
20
21
|
}
|
|
22
|
+
} else if (result.redirect) {
|
|
23
|
+
return {
|
|
24
|
+
redirect: {
|
|
25
|
+
destination: result.uri,
|
|
26
|
+
permanent: result.status === 301,
|
|
27
|
+
},
|
|
28
|
+
}
|
|
21
29
|
}
|
|
22
30
|
return {
|
|
23
31
|
props: result.data,
|