removeStorage
Lưu ý
Với API version ﹤ 2.23.0, phải gọi api login trước khi gọi api này và cần xin cấp quyền tại trang Quản lý ứng dụng
Xoá dữ liệu trong cache.
Parameters
Object object
Property | Type | Default | Required | Description | Minimum Version |
---|---|---|---|---|---|
keys | Array<string> | true | Danh sách các key của dữ liệu cần xoá | ||
success | function | Callback function khi gọi api thành công | |||
fail | function | Callback function khi gọi api thất bại |
Return Values
Promise<Object data>
Property | Type | Description | Minimum Version |
---|---|---|---|
errorKeys | Array<string> | Danh sách các dữ liệu xoá lỗi |
Sample Code
import { removeStorage } from "zmp-sdk/apis";
const removeStorageData = () => {
removeStorage({
keys: ["key1", "key2"],
success: (data) => {
// xử lý khi gọi api thành công
const { errorKeys } = data;
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
},
});
};
Hoặc
import { removeStorage } from "zmp-sdk/apis";
const removeStorageData = async () => {
try {
const { errorKeys } = await removeStorage({
keys: ["key1", "key2"],
});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
};