update
This commit is contained in:
@@ -39,11 +39,11 @@ def update_user(
|
|||||||
now_ = now()
|
now_ = now()
|
||||||
user = SimpleNamespace(**obj)
|
user = SimpleNamespace(**obj)
|
||||||
# Get the user's CPF, if it exists.
|
# Get the user's CPF, if it exists.
|
||||||
old_cpf = persistence_layer.collection.get_item(
|
curr_cpf = persistence_layer.collection.get_item(
|
||||||
KeyPair(
|
KeyPair(
|
||||||
pk=user.id,
|
pk=user.id,
|
||||||
sk=SortKey('0', path_spec='cpf'),
|
sk=SortKey('0', path_spec='cpf'),
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
with persistence_layer.transact_writer() as transact:
|
with persistence_layer.transact_writer() as transact:
|
||||||
@@ -73,7 +73,7 @@ def update_user(
|
|||||||
cond_expr='attribute_not_exists(sk)',
|
cond_expr='attribute_not_exists(sk)',
|
||||||
)
|
)
|
||||||
|
|
||||||
if user.cpf != old_cpf:
|
if user.cpf != curr_cpf:
|
||||||
transact.put(
|
transact.put(
|
||||||
item={
|
item={
|
||||||
'id': 'cpf',
|
'id': 'cpf',
|
||||||
@@ -86,8 +86,8 @@ def update_user(
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Ensures that the old CPF is discarded
|
# Ensures that the old CPF is discarded
|
||||||
if old_cpf:
|
if curr_cpf:
|
||||||
transact.delete(key=KeyPair('cpf', old_cpf))
|
transact.delete(key=KeyPair('cpf', curr_cpf))
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|||||||
@@ -7,25 +7,20 @@ export async function loader({ request, context }: Route.LoaderArgs) {
|
|||||||
const issuerUrl = new URL('/authorize', context.cloudflare.env.ISSUER_URL)
|
const issuerUrl = new URL('/authorize', context.cloudflare.env.ISSUER_URL)
|
||||||
issuerUrl.search = url.search
|
issuerUrl.search = url.search
|
||||||
|
|
||||||
console.log(request.headers.get('Cookie'))
|
|
||||||
|
|
||||||
console.log(issuerUrl.toString())
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const r = await fetch(issuerUrl.toString(), {
|
const r = await fetch(issuerUrl.toString(), {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
Cookie: request.headers.get('Cookie')
|
Cookie: request.headers.get('Cookie')
|
||||||
}
|
},
|
||||||
|
redirect: 'manual'
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(r)
|
return new Response(await r.text(), {
|
||||||
|
status: r.status,
|
||||||
// return new Response(await r.text(), {
|
headers: r.headers
|
||||||
// status: r.status,
|
})
|
||||||
// headers: r.headers
|
|
||||||
// })
|
|
||||||
} catch {
|
} catch {
|
||||||
return new Response(null, { status: 500 })
|
return new Response(null, { status: 500 })
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user