This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Helper: check data and throw error (loader and action) | |
/** | |
* Provide a condition and if that condition is falsey, this throws a 400 | |
* Response with the given message. | |
* | |
* inspired by invariant from 'tiny-invariant' | |
* | |
* @example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ActionArgs, json } from '@remix-run/node'; | |
import { useActionData, useSubmit } from '@remix-run/react'; | |
import { useState } from 'react'; | |
export async function action({ request }: ActionArgs) { | |
const body = await request.formData(); | |
const data = JSON.parse(body.get('data') as string); | |
const firstName = data?.user?.first_name; | |
return json({ message: `Hello, ${firstName}` }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="q-mt-lg"> | |
<q-card v-for="expense in expenses" :key="expense.date" class="q-mb-md cc-card" @click="ccToggle(expense)"> | |
<q-card-title> | |
R$ {{ expense.amount }} | |
<span :class="{ done: expense.done }" slot="subtitle" v-html="dateFormat(expense.date)"></span> | |
</q-card-title> | |
<q-card-separator /> | |
<q-card-main :class="{ done: expense.done }"> | |
{{ expense.description }} |