Skip to content

Commit

Permalink
fix(cors): use gitlab official api
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1ten committed Oct 15, 2023
1 parent df63a21 commit 92a7e2a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion helper/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const browser = window.browser || window.chrome;
export async function loadTemplates() {
return fetch(BASE_URL + "templates.json")
return fetch(BASE_URL + "templates.json" + "/raw?ref=master")
.then((res) => res.json())
.then((res) => {
browser.storage.local.set({ templates: res });
Expand Down
2 changes: 1 addition & 1 deletion src/Template.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BadgeColors } from "../helper/index.js";

function Template({ author, language, name, published, src,local, onDelete }) {
const [copyStatus, setCopyStatus] = React.useState(false);
const url = local ? src : BASE_URL + src;
const url = local ? src : BASE_URL + src + "/raw?ref=master";
const onCopy = () => {
fetch(url)
.then((res) => res.text())
Expand Down
2 changes: 1 addition & 1 deletion webpack.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = merge(config, {
plugins: [
new webpack.DefinePlugin({
BASE_URL: JSON.stringify(
"https://gitlab.com/neet3/Neet/-/raw/master/public/templates/"
"https://gitlab.com/api/v4/projects/51247610/repository/files/public%2Ftemplates%2F"
),
}),
new CopyPlugin({
Expand Down

0 comments on commit 92a7e2a

Please sign in to comment.