updated api preview docs
This commit is contained in:
@@ -123,7 +123,12 @@
|
||||
<div class="docs-content-wrapper">
|
||||
<aside class="docs-sidebar" class:compact={collection?.isAuth}>
|
||||
<nav class="sidebar-content">
|
||||
{#each Object.entries(tabs) as [key, tab] (key)}
|
||||
{#each Object.entries(tabs) as [key, tab], i (key)}
|
||||
<!-- add a separator before the first auth tab -->
|
||||
{#if i === Object.keys(baseTabs).length}
|
||||
<hr class="m-t-sm m-b-sm" />
|
||||
{/if}
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="sidebar-item"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
$: if (collection.isAuth) {
|
||||
baseData = {
|
||||
username: "test_username",
|
||||
email: "test@exampe.com",
|
||||
email: "test@example.com",
|
||||
emailVisibility: true,
|
||||
password: "12345678",
|
||||
passwordConfirm: "12345678",
|
||||
@@ -90,7 +90,12 @@ const pb = new PocketBase('${backendAbsUrl}');
|
||||
const data = ${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection)), null, 4)};
|
||||
|
||||
const record = await pb.collection('${collection?.name}').create(data);
|
||||
`}
|
||||
` + (collection?.isAuth ?
|
||||
`
|
||||
// (optional) send an email verification request
|
||||
await pb.collection('${collection?.name}').requestVerification('test@example.com');
|
||||
` : ""
|
||||
)}
|
||||
dart={`
|
||||
import 'package:pocketbase/pocketbase.dart';
|
||||
|
||||
@@ -102,7 +107,12 @@ final pb = PocketBase('${backendAbsUrl}');
|
||||
final body = <String, dynamic>${JSON.stringify(Object.assign({}, baseData, CommonHelper.dummyCollectionSchemaData(collection)), null, 2)};
|
||||
|
||||
final record = await pb.collection('${collection?.name}').create(body: body);
|
||||
`}
|
||||
` + (collection?.isAuth ?
|
||||
`
|
||||
// (optional) send an email verification request
|
||||
await pb.collection('${collection?.name}').requestVerification('test@example.com');
|
||||
` : ""
|
||||
)}
|
||||
/>
|
||||
|
||||
<h6 class="m-b-xs">API details</h6>
|
||||
|
||||
@@ -959,6 +959,10 @@ export default class CommonHelper {
|
||||
return "0";
|
||||
}
|
||||
|
||||
if (field?.type === "bool") {
|
||||
return "false";
|
||||
}
|
||||
|
||||
// array value
|
||||
if (["select", "relation", "file"].includes(field?.type) && field?.options?.maxSelect != 1) {
|
||||
return "[]";
|
||||
|
||||
Reference in New Issue
Block a user