@batijs/cli 0.0.445 → 0.0.447
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/dist/boilerplates/@batijs/auth0/files/$.env.js +1 -1
- package/dist/boilerplates/@batijs/auth0/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/authjs/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/aws/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/aws/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/aws/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/biome/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/cloudflare/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/compiled/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/compiled/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/d1/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/d1/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/d1/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/d1/files/$wrangler.toml.js +1 -1
- package/dist/boilerplates/@batijs/d1-sqlite/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/drizzle/files/$.env.js +1 -1
- package/dist/boilerplates/@batijs/drizzle/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/drizzle/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/eslint/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/eslint/files/eslint.config.ts +0 -2
- package/dist/boilerplates/@batijs/express/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/express/files/express-entry.ts +0 -11
- package/dist/boilerplates/@batijs/fastify/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/fastify/files/fastify-entry.ts +0 -11
- package/dist/boilerplates/@batijs/google-analytics/files/$.env.js +1 -1
- package/dist/boilerplates/@batijs/h3/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/h3/files/h3-entry.ts +0 -11
- package/dist/boilerplates/@batijs/hattip/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/hattip/files/hattip-entry.ts +0 -11
- package/dist/boilerplates/@batijs/hono/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/hono/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/hono/files/hono-entry.ts +0 -11
- package/dist/boilerplates/@batijs/mantine/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/mantine/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/pnpm/files/$pnpm-workspace.yaml.js +1 -1
- package/dist/boilerplates/@batijs/prettier/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/prettier/files/.prettierignore +0 -7
- package/dist/boilerplates/@batijs/prisma/files/$.env.js +1 -1
- package/dist/boilerplates/@batijs/prisma/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/prisma/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/react/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/react/files/$package.json.js +1 -3
- package/dist/boilerplates/@batijs/react/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/react/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/react/files/layouts/LayoutDefault.tsx +12 -27
- package/dist/boilerplates/@batijs/react/files/pages/+config.ts +1 -1
- package/dist/boilerplates/@batijs/react/files/pages/index/+Page.tsx +2 -7
- package/dist/boilerplates/@batijs/react/files/pages/index/Counter.tsx +2 -15
- package/dist/boilerplates/@batijs/react/files/pages/todo/TodoList.tsx +4 -36
- package/dist/boilerplates/@batijs/react/types/layouts/LayoutDefault.d.ts +0 -1
- package/dist/boilerplates/@batijs/react-sentry/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/sentry/files/$.env.js +1 -1
- package/dist/boilerplates/@batijs/sentry/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/sentry/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/sentry/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/sentry/files/pages/$+client.ts.js +1 -1
- package/dist/boilerplates/@batijs/shadcn-ui/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/shadcn-ui/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/shadcn-ui/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/shadcn-ui/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/shared/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/shared/files/gitignore +0 -7
- package/dist/boilerplates/@batijs/shared-server/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/$package.json.js +1 -3
- package/dist/boilerplates/@batijs/solid/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/solid/files/layouts/LayoutDefault.tsx +12 -27
- package/dist/boilerplates/@batijs/solid/files/pages/+config.ts +1 -1
- package/dist/boilerplates/@batijs/solid/files/pages/index/+Page.tsx +2 -7
- package/dist/boilerplates/@batijs/solid/files/pages/index/Counter.tsx +2 -15
- package/dist/boilerplates/@batijs/solid/files/pages/todo/TodoList.tsx +4 -36
- package/dist/boilerplates/@batijs/solid/types/layouts/LayoutDefault.d.ts +0 -1
- package/dist/boilerplates/@batijs/solid-sentry/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/sqlite/files/$.env.js +1 -1
- package/dist/boilerplates/@batijs/sqlite/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/sqlite/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/tailwindcss/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/telefunc/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/telefunc/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/trpc/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/ts-rest/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/vercel/files/$package.json.js +1 -1
- package/dist/boilerplates/@batijs/vercel/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/vercel/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/vercel/files/pages/$+config.ts.js +1 -1
- package/dist/boilerplates/@batijs/vue/files/$README.md.js +1 -1
- package/dist/boilerplates/@batijs/vue/files/$package.json.js +1 -3
- package/dist/boilerplates/@batijs/vue/files/$tsconfig.json.js +1 -1
- package/dist/boilerplates/@batijs/vue/files/$vite.config.ts.js +1 -1
- package/dist/boilerplates/@batijs/vue/files/components/Content.vue +1 -9
- package/dist/boilerplates/@batijs/vue/files/components/Counter.vue +1 -22
- package/dist/boilerplates/@batijs/vue/files/components/Logo.vue +1 -10
- package/dist/boilerplates/@batijs/vue/files/components/Sidebar.vue +1 -20
- package/dist/boilerplates/@batijs/vue/files/layouts/LayoutDefault.vue +0 -4
- package/dist/boilerplates/@batijs/vue/files/pages/+config.ts +1 -1
- package/dist/boilerplates/@batijs/vue/files/pages/index/+Page.vue +1 -4
- package/dist/boilerplates/@batijs/vue/files/pages/todo/TodoList.vue +2 -34
- package/dist/boilerplates/@batijs/vue-sentry/files/$package.json.js +1 -1
- package/dist/boilerplates/boilerplates.json +0 -70
- package/dist/{chunk-YO6CY4MA.js → chunk-RIWHL2V7.js} +9848 -9848
- package/dist/index.js +4 -36
- package/package.json +5 -5
- package/dist/boilerplates/@batijs/express/files/global.d.ts +0 -10
- package/dist/boilerplates/@batijs/fastify/files/global.d.ts +0 -10
- package/dist/boilerplates/@batijs/firebase-auth/files/$.env.js +0 -24
- package/dist/boilerplates/@batijs/firebase-auth/files/$README.md.js +0 -39
- package/dist/boilerplates/@batijs/firebase-auth/files/$package.json.js +0 -133
- package/dist/boilerplates/@batijs/firebase-auth/files/firebase/$service-account.json.js +0 -26
- package/dist/boilerplates/@batijs/firebase-auth/files/global.d.ts +0 -11
- package/dist/boilerplates/@batijs/firebase-auth/files/libs/firebaseAdmin.ts +0 -15
- package/dist/boilerplates/@batijs/firebase-auth/files/libs/firebaseUI.ts +0 -31
- package/dist/boilerplates/@batijs/firebase-auth/files/pages/+client.ts +0 -30
- package/dist/boilerplates/@batijs/firebase-auth/files/pages/login/+config.ts +0 -6
- package/dist/boilerplates/@batijs/firebase-auth/files/pages/login/+guard.ts +0 -11
- package/dist/boilerplates/@batijs/firebase-auth/files/server/firebase-auth-middleware.ts +0 -71
- package/dist/boilerplates/@batijs/firebase-auth/types/libs/firebaseAdmin.d.ts +0 -5
- package/dist/boilerplates/@batijs/firebase-auth/types/libs/firebaseUI.d.ts +0 -5
- package/dist/boilerplates/@batijs/firebase-auth/types/pages/+client.d.ts +0 -1
- package/dist/boilerplates/@batijs/firebase-auth/types/pages/login/+config.d.ts +0 -4
- package/dist/boilerplates/@batijs/firebase-auth/types/pages/login/+guard.d.ts +0 -3
- package/dist/boilerplates/@batijs/firebase-auth/types/server/firebase-auth-middleware.d.ts +0 -4
- package/dist/boilerplates/@batijs/h3/files/global.d.ts +0 -10
- package/dist/boilerplates/@batijs/hono/files/global.d.ts +0 -10
- package/dist/boilerplates/@batijs/panda-css/files/$package.json.js +0 -93
- package/dist/boilerplates/@batijs/panda-css/files/layouts/panda.css +0 -1
- package/dist/boilerplates/@batijs/panda-css/files/panda.config.ts +0 -32
- package/dist/boilerplates/@batijs/panda-css/files/postcss.config.js +0 -5
- package/dist/boilerplates/@batijs/panda-css/types/panda.config.d.ts +0 -4
- package/dist/boilerplates/@batijs/react-firebase-auth/files/pages/login/+Page.tsx +0 -52
- package/dist/boilerplates/@batijs/react-firebase-auth/types/pages/login/+Page.d.ts +0 -3
- package/dist/boilerplates/@batijs/solid-firebase-auth/files/pages/login/+Page.tsx +0 -52
- package/dist/boilerplates/@batijs/solid-firebase-auth/types/pages/login/+Page.d.ts +0 -3
- package/dist/boilerplates/@batijs/vue-firebase-auth/files/pages/login/+Page.vue +0 -51
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { createRequire as createRequire_BATI_CLI } from 'module';
|
|
3
|
-
const require = createRequire_BATI_CLI(import.meta.url);
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
ata
|
|
7
|
-
} from "../../../../chunk-YO6CY4MA.js";
|
|
8
|
-
import "../../../../chunk-V7W2TXCE.js";
|
|
9
|
-
import "../../../../chunk-DHZ7AZKP.js";
|
|
10
|
-
|
|
11
|
-
// ../../boilerplates/panda-css/dist/files/$package.json.js
|
|
12
|
-
var __create = Object.create;
|
|
13
|
-
var __defProp = Object.defineProperty;
|
|
14
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
15
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
16
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
17
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
18
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
19
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
20
|
-
};
|
|
21
|
-
var __copyProps = (to, from, except, desc) => {
|
|
22
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
23
|
-
for (let key of __getOwnPropNames(from))
|
|
24
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
25
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
26
|
-
}
|
|
27
|
-
return to;
|
|
28
|
-
};
|
|
29
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
30
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
31
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
32
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
33
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
34
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
35
|
-
mod
|
|
36
|
-
));
|
|
37
|
-
var require_package = __commonJS({
|
|
38
|
-
"package.json"(exports, module) {
|
|
39
|
-
module.exports = {
|
|
40
|
-
name: "@batijs/panda-css",
|
|
41
|
-
private: true,
|
|
42
|
-
version: "0.0.1",
|
|
43
|
-
description: "",
|
|
44
|
-
type: "module",
|
|
45
|
-
scripts: {
|
|
46
|
-
"check-types": "tsc --noEmit",
|
|
47
|
-
build: "bati-compile-boilerplate"
|
|
48
|
-
},
|
|
49
|
-
keywords: [],
|
|
50
|
-
author: "",
|
|
51
|
-
license: "MIT",
|
|
52
|
-
devDependencies: {
|
|
53
|
-
"@batijs/compile": "workspace:*",
|
|
54
|
-
"@pandacss/dev": "^0.54.0",
|
|
55
|
-
"@types/node": "^18.19.111",
|
|
56
|
-
postcss: "^8.5.5"
|
|
57
|
-
},
|
|
58
|
-
dependencies: {
|
|
59
|
-
"@batijs/core": "workspace:*"
|
|
60
|
-
},
|
|
61
|
-
files: [
|
|
62
|
-
"dist/"
|
|
63
|
-
],
|
|
64
|
-
bati: {
|
|
65
|
-
if: {
|
|
66
|
-
flag: "panda-css"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
exports: {
|
|
70
|
-
"./panda.config": {
|
|
71
|
-
types: "./dist/types/panda.config.d.ts"
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
typesVersions: {
|
|
75
|
-
"*": {
|
|
76
|
-
"panda.config": [
|
|
77
|
-
"./dist/types/panda.config.d.ts"
|
|
78
|
-
]
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
async function getPackageJson(props) {
|
|
85
|
-
const packageJson = await ata(props, await Promise.resolve().then(() => __toESM(require_package(), 1)).then((x) => x.default));
|
|
86
|
-
return packageJson.setScript("prepare", {
|
|
87
|
-
value: "panda codegen",
|
|
88
|
-
precedence: 20
|
|
89
|
-
}).addDevDependencies(["@pandacss/dev", "postcss"]).addDependencies([]);
|
|
90
|
-
}
|
|
91
|
-
export {
|
|
92
|
-
getPackageJson as default
|
|
93
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
@layer reset, base, tokens, recipes, utilities;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { defineConfig } from "@pandacss/dev";
|
|
2
|
-
|
|
3
|
-
export default defineConfig({
|
|
4
|
-
// Whether to use css reset
|
|
5
|
-
preflight: true,
|
|
6
|
-
|
|
7
|
-
// Where to look for your css declarations
|
|
8
|
-
include: BATI.has("vue")
|
|
9
|
-
? [
|
|
10
|
-
"./components/**/*.{js,jsx,ts,tsx,vue}",
|
|
11
|
-
"./layouts/**/*.{js,jsx,ts,tsx,vue}",
|
|
12
|
-
"./pages/**/*.{js,jsx,ts,tsx,vue}",
|
|
13
|
-
"./src/**/*.{js,jsx,ts,tsx,vue}",
|
|
14
|
-
]
|
|
15
|
-
: [
|
|
16
|
-
"./components/**/*.{js,jsx,ts,tsx}",
|
|
17
|
-
"./layouts/**/*.{js,jsx,ts,tsx}",
|
|
18
|
-
"./pages/**/*.{js,jsx,ts,tsx}",
|
|
19
|
-
"./src/**/*.{js,jsx,ts,tsx}",
|
|
20
|
-
],
|
|
21
|
-
|
|
22
|
-
// Files to exclude
|
|
23
|
-
exclude: [],
|
|
24
|
-
|
|
25
|
-
// Useful for theme customization
|
|
26
|
-
theme: {
|
|
27
|
-
extend: {},
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
// The output directory for your css system
|
|
31
|
-
outdir: "styled-system",
|
|
32
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import "firebaseui/dist/firebaseui.css";
|
|
2
|
-
import { startFirebaseUI } from "@batijs/firebase-auth/libs/firebaseUI";
|
|
3
|
-
import { getAuth, type UserCredential } from "firebase/auth";
|
|
4
|
-
import * as firebaseui from "firebaseui";
|
|
5
|
-
import { useEffect, useState } from "react";
|
|
6
|
-
import { reload } from "vike/client/router";
|
|
7
|
-
|
|
8
|
-
export default Page;
|
|
9
|
-
|
|
10
|
-
function Page() {
|
|
11
|
-
const [error, setError] = useState("");
|
|
12
|
-
|
|
13
|
-
async function sessionLogin(authResult: UserCredential) {
|
|
14
|
-
const idToken = (await authResult.user.getIdToken()) || "";
|
|
15
|
-
try {
|
|
16
|
-
const response = await fetch("/api/sessionLogin", {
|
|
17
|
-
method: "POST",
|
|
18
|
-
body: JSON.stringify({ idToken }),
|
|
19
|
-
headers: {
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
if (response.ok) {
|
|
24
|
-
await reload();
|
|
25
|
-
} else {
|
|
26
|
-
setError(response.statusText);
|
|
27
|
-
}
|
|
28
|
-
await getAuth().signOut();
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.log("error :", err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
useEffect(() => {
|
|
35
|
-
const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(getAuth());
|
|
36
|
-
if (!error) {
|
|
37
|
-
startFirebaseUI(ui, sessionLogin);
|
|
38
|
-
}
|
|
39
|
-
}, [error]);
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
<div id="firebaseui-auth-container"></div>
|
|
44
|
-
{error && (
|
|
45
|
-
<>
|
|
46
|
-
<div style={{ color: "red" }}>There is an error occured : {error}</div>
|
|
47
|
-
<button onClick={() => setError("")}>Try Again</button>
|
|
48
|
-
</>
|
|
49
|
-
)}
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import "firebaseui/dist/firebaseui.css";
|
|
2
|
-
import { startFirebaseUI } from "@batijs/firebase-auth/libs/firebaseUI";
|
|
3
|
-
import { getAuth, type UserCredential } from "firebase/auth";
|
|
4
|
-
import * as firebaseui from "firebaseui";
|
|
5
|
-
import { createEffect, createSignal } from "solid-js";
|
|
6
|
-
import { reload } from "vike/client/router";
|
|
7
|
-
|
|
8
|
-
export default Page;
|
|
9
|
-
|
|
10
|
-
function Page() {
|
|
11
|
-
const [error, setError] = createSignal("");
|
|
12
|
-
|
|
13
|
-
async function sessionLogin(authResult: UserCredential) {
|
|
14
|
-
const idToken = (await authResult.user.getIdToken()) || "";
|
|
15
|
-
try {
|
|
16
|
-
const response = await fetch("/api/sessionLogin", {
|
|
17
|
-
method: "POST",
|
|
18
|
-
body: JSON.stringify({ idToken }),
|
|
19
|
-
headers: {
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
if (response.ok) {
|
|
24
|
-
await reload();
|
|
25
|
-
} else {
|
|
26
|
-
setError(response.statusText);
|
|
27
|
-
}
|
|
28
|
-
await getAuth().signOut();
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.log("error :", err);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
createEffect(() => {
|
|
35
|
-
const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(getAuth());
|
|
36
|
-
if (!error()) {
|
|
37
|
-
startFirebaseUI(ui, sessionLogin);
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
<div id="firebaseui-auth-container" />
|
|
44
|
-
{error() && (
|
|
45
|
-
<>
|
|
46
|
-
<div style={{ color: "red" }}>There is an error occured : {error()}</div>
|
|
47
|
-
<button onClick={() => setError("")}>Try Again</button>
|
|
48
|
-
</>
|
|
49
|
-
)}
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div id="firebaseui-auth-container"></div>
|
|
3
|
-
<div v-if="error">
|
|
4
|
-
<div style="color: red">There is an error occured : {{ error }}</div>
|
|
5
|
-
<button @click="clearError">Try Again</button>
|
|
6
|
-
</div>
|
|
7
|
-
</template>
|
|
8
|
-
|
|
9
|
-
<script setup lang="ts">
|
|
10
|
-
import "firebaseui/dist/firebaseui.css";
|
|
11
|
-
import { onMounted, onUpdated, ref } from "vue";
|
|
12
|
-
import * as firebaseui from "firebaseui";
|
|
13
|
-
import { getAuth, type UserCredential } from "firebase/auth";
|
|
14
|
-
import { reload } from "vike/client/router";
|
|
15
|
-
import { startFirebaseUI } from "@batijs/firebase-auth/libs/firebaseUI";
|
|
16
|
-
|
|
17
|
-
const error = ref("");
|
|
18
|
-
const clearError = () => (error.value = "");
|
|
19
|
-
const ui = firebaseui.auth.AuthUI.getInstance() || new firebaseui.auth.AuthUI(getAuth());
|
|
20
|
-
|
|
21
|
-
async function sessionLogin(authResult: UserCredential) {
|
|
22
|
-
const idToken = (await authResult.user.getIdToken()) || "";
|
|
23
|
-
try {
|
|
24
|
-
const response = await fetch("/api/sessionLogin", {
|
|
25
|
-
method: "POST",
|
|
26
|
-
body: JSON.stringify({ idToken }),
|
|
27
|
-
headers: {
|
|
28
|
-
"Content-Type": "application/json",
|
|
29
|
-
},
|
|
30
|
-
});
|
|
31
|
-
if (response.ok) {
|
|
32
|
-
await reload();
|
|
33
|
-
} else {
|
|
34
|
-
error.value = response.statusText;
|
|
35
|
-
}
|
|
36
|
-
await getAuth().signOut();
|
|
37
|
-
} catch (err) {
|
|
38
|
-
console.log("error :", err);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
onMounted(() => {
|
|
43
|
-
startFirebaseUI(ui, sessionLogin);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
onUpdated(() => {
|
|
47
|
-
if (!error.value) {
|
|
48
|
-
startFirebaseUI(ui, sessionLogin);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
</script>
|