Skip to content

Commit

Permalink
fix(web): fix to use new function debug token header & url
Browse files Browse the repository at this point in the history
  • Loading branch information
maslow committed Dec 21, 2022
1 parent 46122a6 commit 99cf35c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion web/src/pages/app/functions/mods/DebugPannel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export default function DebugPanel() {
param: JSON.parse(params),
},
headers: {
Authorization: `Bearer ${globalStore.currentApp?.function_debug_token}`,
"x-laf-debug-token": `${globalStore.currentApp?.function_debug_token}`,
},
});
setRunningResData(res.data);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const defaultString = `import cloud from '@/cloud-sdk'
const defaultString = `
import cloud from '@lafjs/cloud'
exports.main = async function (ctx: FunctionContext) {
const { auth, body, query } = ctx
console.log('Hello World')
return { hello: 'LaF'}
return { data: 'hi, laf'}
}
`;
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/app/functions/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const useFunctionStore = create<State>()(
const currentFunction = get().currentFunction;

return currentFunction?.name
? `http://${currentApp?.gateway.status.appRoute.domain}/debug/${currentFunction?.name}`
? `http://${currentApp?.gateway.status.appRoute.domain}/${currentFunction?.name}`
: "";
},

Expand Down
14 changes: 7 additions & 7 deletions web/src/pages/app/logs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ export default function LogsPage() {
<Thead>
<Tr>
<Th width={"200px"}>时间</Th>
<Th width={"360px"}>Request ID</Th>
<Th width={"200px"}>Request ID</Th>
<Th>函数名</Th>
<Th isNumeric>执行用时</Th>
<Th isNumeric>操作</Th>
<Th>Content</Th>
<Th>操作</Th>
</Tr>
</Thead>

Expand All @@ -133,9 +133,9 @@ export default function LogsPage() {
return (
<Tr key={item._id} _hover={{ bgColor: "#efefef" }}>
<Td width={"200px"} className=" text-black-600 ">
{formatDate(item.created_at)}
{formatDate(item.created_at, "YYYY-MM-DD HH:mm:ss")}
</Td>
<Td width={"360px"}>
<Td width={"200px"}>
<CopyText text={item.request_id}>
<span>{item.request_id}</span>
</CopyText>
Expand All @@ -145,8 +145,8 @@ export default function LogsPage() {
<span>{item.func}</span>
</CopyText>
</Td>
<Td isNumeric>
<span className=" text-green-700">{item.time_usage} ms</span>
<Td>
<span className="text-green-700">{item.data}</span>
</Td>
<Td isNumeric>
<Button variant={"link"} size="xs" colorScheme={"blue"}>
Expand Down

0 comments on commit 99cf35c

Please sign in to comment.