Refactor redis calls.
This commit is contained in:
@@ -39,7 +39,7 @@ export async function deleteAccount(userId) {
|
||||
}),
|
||||
])
|
||||
.then(async res => {
|
||||
if (redis.client) {
|
||||
if (redis.enabled) {
|
||||
for (let i = 0; i < websiteUuids.length; i++) {
|
||||
await redis.set(`website:${websiteUuids[i]}`, DELETED);
|
||||
}
|
||||
|
||||
@@ -14,8 +14,8 @@ export async function createWebsite(userId, data) {
|
||||
},
|
||||
})
|
||||
.then(async res => {
|
||||
if (redis.client && res) {
|
||||
await redis.client.set(`website:${res.websiteUuid}`, res.id);
|
||||
if (redis.enabled && res) {
|
||||
await redis.set(`website:${res.websiteUuid}`, res.id);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -21,8 +21,8 @@ export async function deleteWebsite(websiteUuid) {
|
||||
where: { websiteUuid },
|
||||
}),
|
||||
]).then(async res => {
|
||||
if (redis.client) {
|
||||
await redis.client.set(`website:${websiteUuid}`, DELETED);
|
||||
if (redis.enabled) {
|
||||
await redis.set(`website:${websiteUuid}`, DELETED);
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function getWebsite(where) {
|
||||
})
|
||||
.then(async data => {
|
||||
if (redis.enabled && data) {
|
||||
await redis.client.set(`website:${data.websiteUuid}`, data.id);
|
||||
await redis.set(`website:${data.websiteUuid}`, data.id);
|
||||
}
|
||||
|
||||
return data;
|
||||
|
||||
Reference in New Issue
Block a user