Renovation
Search…
.default
Defaults controller is used to set and get key-value pairs used across the application.
TIP: The value can be an object.

.setDefault()

To set the value of a key. Optionally, pass the parent param if the key was set under a different parent.
When setting values, they are stringified before adding it in the server.

Input

SetDefaultParams
property
type
required
description
key
string
yes
Key of the value required.
value
DefaultValueTypes
yes
The value to assign to the key. Can be an object.
parent
string
no
Can specify the parent if the key is duplicated under a different parent. By default uses '__default' as parent.

Output

DefaultValueTypes

Example

async-await
1
const response = await renovationInstance.defaults.setDefault({
2
key: "disableSubmission",
3
value: false
4
});
5
6
// response.data => "false"
7
console.log("Response: ", response.data);
Copied!
Classic Promise
1
renovationInstance.defaults
2
.setDefault({
3
key: "disableSubmission",
4
value: false
5
})
6
// response.data => "false"
7
.then(response => console.log("Response: ", response.data));
Copied!

.getDefault() ★

To get the value of a key. Optionally, pass the parent param if the key was set under a different parent.
The values are parsed from string when retrieved from the backend.

Input parameters

GetDefaultParams
property
type
required
description
key
string
yes
Key of the value required.
parent
string
no
Can specify the parent if the key is duplicated under a different parent. By default uses '__default' as parent.

Output

unknown
The output since the value can be of many types based on JSON.parse()

Example

async-await
1
const value = await renovationInstance.defaults.getDefault({
2
key: "disableSubmission",
3
parent: "specific"
4
});
5
// value.data => false
6
console.log("Value: ", value.data);
Copied!
Classic Promise
1
renovationInstance.defaults
2
.getDefault({
3
key: "disableSubmission",
4
parent: "specific"
5
})
6
// value.data => false
7
.then(value => console.log("Value: ", value.data));
Copied!
In case the key is not found, a successful empty response is returned.
1
{
2
"success": true,
3
"httpCode": 200
4
}
Copied!
Last modified 1yr ago