Skip to content

Commit cafb057

Browse files
chore: wip
1 parent c74b36d commit cafb057

File tree

16 files changed

+117
-29
lines changed

16 files changed

+117
-29
lines changed

app/Models/SubscriberEmail.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export default {
2424
attributes: {
2525
email: {
2626
unique: true,
27+
fillable: true,
2728
validation: {
2829
rule: schema.string().email(),
2930
message: {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<script setup lang="ts">
2+
const props = defineProps<{
3+
loading: boolean
4+
buttonText: boolean
5+
classString: string
6+
}>()
7+
8+
const fullClass = computed(() => {
9+
let cls = ' duration-150 ease-in-out transition'
10+
11+
if (props.loading) {
12+
cls += ` opacity-75 disabled:cursor-not-allowed `
13+
}
14+
15+
return props.classString + cls
16+
})
17+
</script>
18+
19+
<template>
20+
<button type="button" :class="fullClass" :disabled="props.loading">
21+
<svg
22+
v-if="props.loading"
23+
class="w-5 h-5 mr-1 -ml-1 text-gray-500 animate-spin"
24+
fill="none"
25+
viewBox="0 0 24 24"
26+
>
27+
<circle
28+
class="opacity-25"
29+
cx="12"
30+
cy="12"
31+
r="10"
32+
stroke="currentColor"
33+
stroke-width="4"
34+
/>
35+
<path
36+
class="opacity-75"
37+
fill="currentColor"
38+
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
39+
/>
40+
</svg>
41+
42+
{{ props.buttonText }}
43+
</button>
44+
</template>

resources/components/Marketing/ComingSoon.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<script setup>
22
import { ref } from 'vue'
3+
import BaseButton from '../Buttons/BaseButton.vue'
34
45
// Reactive state for the email input
56
const email = ref('')
67
8+
const loading = ref(false)
9+
710
// Method to handle email submission
811
async function submitEmail() {
912
const body = {
@@ -12,6 +15,7 @@ async function submitEmail() {
1215
1316
const url = 'http://localhost:3008/api/email/subscribe'
1417
18+
loading.value = true
1519
await fetch(url, {
1620
method: 'POST',
1721
headers: {
@@ -22,6 +26,8 @@ async function submitEmail() {
2226
})
2327
2428
email.value = '' // Clear the input field after submission
29+
30+
loading.value = false
2531
}
2632
</script>
2733

@@ -76,9 +82,7 @@ async function submitEmail() {
7682
<input id="email" v-model="email" type="email" name="email" class="block w-full rounded-none rounded-l-md border-0 py-1.5 pl-10 text-gray-900 ring-1 ring-inset ring-gray-300 placeholder:text-gray-400 focus:ring-2 focus:ring-inset focus:ring-blue-600 sm:text-sm sm:leading-6" placeholder="enter-your@email.com">
7783
</div>
7884

79-
<button type="button" class="relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50" @click="submitEmail">
80-
Submit
81-
</button>
85+
<BaseButton buttonText="Submit" classString="relative -ml-px inline-flex items-center gap-x-1.5 rounded-r-md px-3 py-2 text-sm font-semibold text-gray-900 ring-1 ring-inset ring-gray-300 hover:bg-gray-50" :loading="loading" @click.native="submitEmail" />
8286
</div>
8387
</div>
8488

resources/views/auth/login.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,14 @@ async function login() {
2020
method: 'POST',
2121
headers: {
2222
'Content-Type': 'application/json',
23-
'Accept': 'application/json',
23+
Accept: 'application/json',
2424
},
2525
body: JSON.stringify(body),
2626
})
2727
2828
if (!response.ok) {
2929
const res = await response.json()
30-
}
31-
else {
30+
} else {
3231
const data = await response.json()
3332
3433
localStorage.setItem('token', data.token)

storage/framework/core/actions/src/orm/generate-model.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,14 +1131,18 @@ async function generateModelString(
11311131
}
11321132
11331133
// Method to create a new ${formattedModelName}
1134-
static async create(new${modelName}: New${modelName}): Promise<${modelName}Model> {
1134+
static async create(new${modelName}: New${modelName}): Promise<${modelName}Model | undefined> {
11351135
const instance = new this(null)
11361136
const filteredValues = Object.keys(new${modelName})
11371137
.filter(key => instance.fillable.includes(key))
11381138
.reduce((obj: any, key) => {
11391139
obj[key] = new${modelName}[key];
11401140
return obj
1141-
}, {}) as new${modelName}
1141+
}, {})
1142+
1143+
if (Object.keys(filteredValues).length === 0) {
1144+
return undefined
1145+
}
11421146
11431147
const result = await db.insertInto('${tableName}')
11441148
.values(filteredValues)

storage/framework/core/router/src/server.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ async function execute(foundRoute: Route, req: Request, { statusCode }: Options)
242242
status: 403,
243243
})
244244
}
245-
245+
246246
if (foundCallback.status === 422) {
247247
// biome-ignore lint/performance/noDelete: <explanation>
248248
delete foundCallback.status
@@ -257,7 +257,6 @@ async function execute(foundRoute: Route, req: Request, { statusCode }: Options)
257257
})
258258
}
259259

260-
261260
if (foundCallback.status === 500) {
262261
delete foundCallback.status
263262
return await new Response(JSON.stringify(foundCallback), {

storage/framework/orm/src/models/AccessToken.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,18 @@ export class AccessTokenModel {
231231
}
232232

233233
// Method to create a new accesstoken
234-
static async create(newAccessToken: NewAccessToken): Promise<AccessTokenModel> {
234+
static async create(newAccessToken: NewAccessToken): Promise<AccessTokenModel | undefined> {
235235
const instance = new this(null)
236236
const filteredValues = Object.keys(newAccessToken)
237237
.filter((key) => instance.fillable.includes(key))
238238
.reduce((obj: any, key) => {
239239
obj[key] = newAccessToken[key]
240240
return obj
241-
}, {}) as newAccessToken
241+
}, {})
242+
243+
if (Object.keys(filteredValues).length === 0) {
244+
return undefined
245+
}
242246

243247
const result = await db.insertInto('personal_access_tokens').values(filteredValues).executeTakeFirstOrThrow()
244248

storage/framework/orm/src/models/Deployment.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,18 @@ export class DeploymentModel {
239239
}
240240

241241
// Method to create a new deployment
242-
static async create(newDeployment: NewDeployment): Promise<DeploymentModel> {
242+
static async create(newDeployment: NewDeployment): Promise<DeploymentModel | undefined> {
243243
const instance = new this(null)
244244
const filteredValues = Object.keys(newDeployment)
245245
.filter((key) => instance.fillable.includes(key))
246246
.reduce((obj: any, key) => {
247247
obj[key] = newDeployment[key]
248248
return obj
249-
}, {}) as newDeployment
249+
}, {})
250+
251+
if (Object.keys(filteredValues).length === 0) {
252+
return undefined
253+
}
250254

251255
const result = await db.insertInto('deployments').values(filteredValues).executeTakeFirstOrThrow()
252256

storage/framework/orm/src/models/Post.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,14 +224,18 @@ export class PostModel {
224224
}
225225

226226
// Method to create a new post
227-
static async create(newPost: NewPost): Promise<PostModel> {
227+
static async create(newPost: NewPost): Promise<PostModel | undefined> {
228228
const instance = new this(null)
229229
const filteredValues = Object.keys(newPost)
230230
.filter((key) => instance.fillable.includes(key))
231231
.reduce((obj: any, key) => {
232232
obj[key] = newPost[key]
233233
return obj
234-
}, {}) as newPost
234+
}, {})
235+
236+
if (Object.keys(filteredValues).length === 0) {
237+
return undefined
238+
}
235239

236240
const result = await db.insertInto('posts').values(filteredValues).executeTakeFirstOrThrow()
237241

storage/framework/orm/src/models/Project.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,14 +226,18 @@ export class ProjectModel {
226226
}
227227

228228
// Method to create a new project
229-
static async create(newProject: NewProject): Promise<ProjectModel> {
229+
static async create(newProject: NewProject): Promise<ProjectModel | undefined> {
230230
const instance = new this(null)
231231
const filteredValues = Object.keys(newProject)
232232
.filter((key) => instance.fillable.includes(key))
233233
.reduce((obj: any, key) => {
234234
obj[key] = newProject[key]
235235
return obj
236-
}, {}) as newProject
236+
}, {})
237+
238+
if (Object.keys(filteredValues).length === 0) {
239+
return undefined
240+
}
237241

238242
const result = await db.insertInto('projects').values(filteredValues).executeTakeFirstOrThrow()
239243

0 commit comments

Comments
 (0)