feat: changes global find and update payload api from global to slug as the key to find/update with

This commit is contained in:
Jarrod Flesch
2021-03-22 09:15:55 -04:00
parent 39000bdcb2
commit c71ba2b079
3 changed files with 4 additions and 4 deletions

View File

@@ -275,7 +275,7 @@ The following Global operations are available through the Local API:
```js ```js
// Result will be the Header Global. // Result will be the Header Global.
const result = await payload.findGlobal({ const result = await payload.findGlobal({
global: 'header', // required slug: 'header', // required
depth: 2, depth: 2,
locale: 'en', locale: 'en',
fallbackLocale: false, fallbackLocale: false,
@@ -290,7 +290,7 @@ const result = await payload.findGlobal({
```js ```js
// Result will be the updated Header Global. // Result will be the updated Header Global.
const result = await payload.updateGlobal({ const result = await payload.updateGlobal({
global: 'header', // required slug: 'header', // required
data: { // required data: { // required
nav: [ nav: [
{ {

View File

@@ -1,6 +1,6 @@
async function findOne(options) { async function findOne(options) {
const { const {
global: globalSlug, slug: globalSlug,
depth, depth,
locale = this?.config?.localization?.defaultLocale, locale = this?.config?.localization?.defaultLocale,
fallbackLocale = null, fallbackLocale = null,

View File

@@ -1,6 +1,6 @@
async function update(options) { async function update(options) {
const { const {
global: globalSlug, slug: globalSlug,
depth, depth,
locale = this?.config?.localization?.defaultLocale, locale = this?.config?.localization?.defaultLocale,
fallbackLocale = null, fallbackLocale = null,