Skip to content

Commit

Permalink
fix: update custom CSS for GP
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinKolarik committed Jun 3, 2024
1 parent 79b7952 commit 8a3afcb
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/extensions/migrations/20240603A-update-custom-css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
const DIRECTUS_URL = process.env.DIRECTUS_URL;
const ADMIN_ACCESS_TOKEN = process.env.ADMIN_ACCESS_TOKEN;

async function updateCssRules () {
const URL = `${DIRECTUS_URL}/settings?access_token=${ADMIN_ACCESS_TOKEN}`;
const response = await fetch(URL, {
method: 'PATCH',
body: JSON.stringify({
custom_css:
`body:has(.router-link-active[href="/admin/content/gp_tokens"]) .search-input {
display: none !important;
}
.module-bar-logo {
background-color: inherit !important;
}
.module-bar-logo .custom-logo {
scale: .7;
}`,
}),
headers: {
'Content-Type': 'application/json',
},
}).then((response) => {
if (!response.ok) {
throw new Error(`Fetch request failed. Status: ${response.status}`);
}

return response.json();
});
return response.data;
}

export async function up () {
await updateCssRules();
console.log('Successfully updated custom css.');
}

export async function down () {
console.log('There is no down operation for that migration.');
}

0 comments on commit 8a3afcb

Please sign in to comment.